Mapping a CMP bean to more than one table
Hello,
I like to map a CMP bean to more than one table. I am using wlserver7.0 SP2. I
have a VendorBean with a CMP field "comments" mapped to VENDOR_COMMENTS table.
All other CMP fields in VendorBean are mapped to VENDOR table. Below is the snippet
of weblogic-cmp-rdbms-jar.xml:
<weblogic-rdbms-bean>
<ejb-name>VendorBean</ejb-name>
<data-source-name>sweepDataSource</data-source-name>
<table-map>
<table-name>VENDOR</table-name>
<field-map>
<cmp-field>expIndicator</cmp-field>
<dbms-column>VENDOR_EXP_IND</dbms-column>
</field-map>
<field-map>
<cmp-field>vendorId</cmp-field>
<dbms-column>VENDOR_SEQ_KEY</dbms-column>
</field-map>
</table-map>
<table-map>
<table-name>VENDOR_COMMENTS</table-name>
<field-map>
<cmp-field>vendorId</cmp-field>
<dbms-column>VENDOR_SEQ_KEY</dbms-column>
</field-map>
<field-map>
<cmp-field>comments</cmp-field>
<dbms-column>VENDOR_COMMENT</dbms-column>
</field-map>
</table-map>
As you can see, "vendorId" is the primary key cmp field mapped to VENDOR_SEQ_KEY
column in both tables. The relationship between the table rows are 1 to 1. When
I run ejbc, I get the exception below:
[ejbc] weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Asserti
on violated ]
[ejbc] at weblogic.utils.Debug.assertion(Debug.java:74)
[ejbc] at weblogic.ejb20.cmp.rdbms.RDBMSBean.processRole(RDBMSBean.java
:1389)
[ejbc] at weblogic.ejb20.cmp.rdbms.RDBMSBean.processDescriptors(RDBMSBe
an.java:1105)
[ejbc] at weblogic.ejb20.cmp.rdbms.Deployer.readTypeSpecificData(Deploy
er.java:299)
[ejbc] at weblogic.ejb20.persistence.PersistenceType.setTypeSpecificFil
e(PersistenceType.java:490)
[ejbc] at weblogic.ejb20.persistence.PersistenceType.setupDeployer(Pers
istenceType.java:407)
[ejbc] at weblogic.ejb20.deployer.CMPInfoImpl.setup(CMPInfoImpl.java:11
4)
[ejbc] at weblogic.ejb20.ejbc.EJB20CMPCompiler.generatePersistenceSourc
es(EJB20CMPCompiler.java:64)
[ejbc] at weblogic.ejb20.ejbc.EJBCompiler.doCompile(EJBCompiler.java:22
3)
[ejbc] at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:3
44)
[ejbc] at weblogic.ejbc20.runBody(ejbc20.java:470)
[ejbc] at weblogic.utils.compiler.Tool.run(Tool.java:126)
[ejbc] at weblogic.ejbc20.main(ejbc20.java:711)
But if I put the "comments" <field-map> inside the VENDOR <table-map> and get
rid off the <table-map> for VENDOR_COMMENTS, I was able to run ejbc. Of course,
I get the run time exception during deployment because, there is no column called
"VENDOR_COMMENT" in VENDOR table. Please help me. Thanks a million.
Wrong newsgroup, needs to go to one of the ejb newsgroups.
mbg
"Sai S Prasad" <[email protected]> wrote in message
news:[email protected]...
>
Hello,
I like to map a CMP bean to more than one table. I am using wlserver7.0SP2. I
have a VendorBean with a CMP field "comments" mapped to VENDOR_COMMENTStable.
All other CMP fields in VendorBean are mapped to VENDOR table. Below isthe snippet
of weblogic-cmp-rdbms-jar.xml:
<weblogic-rdbms-bean>
<ejb-name>VendorBean</ejb-name>
<data-source-name>sweepDataSource</data-source-name>
<table-map>
<table-name>VENDOR</table-name>
<field-map>
<cmp-field>expIndicator</cmp-field>
<dbms-column>VENDOR_EXP_IND</dbms-column>
</field-map>
<field-map>
<cmp-field>vendorId</cmp-field>
<dbms-column>VENDOR_SEQ_KEY</dbms-column>
</field-map>
</table-map>
<table-map>
<table-name>VENDOR_COMMENTS</table-name>
<field-map>
<cmp-field>vendorId</cmp-field>
<dbms-column>VENDOR_SEQ_KEY</dbms-column>
</field-map>
<field-map>
<cmp-field>comments</cmp-field>
<dbms-column>VENDOR_COMMENT</dbms-column>
</field-map>
</table-map>
As you can see, "vendorId" is the primary key cmp field mapped toVENDOR_SEQ_KEY
column in both tables. The relationship between the table rows are 1 to 1.When
I run ejbc, I get the exception below:
[ejbc] weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[Asserti
on violated ]
[ejbc] at weblogic.utils.Debug.assertion(Debug.java:74)
[ejbc] atweblogic.ejb20.cmp.rdbms.RDBMSBean.processRole(RDBMSBean.java
:1389)
[ejbc] atweblogic.ejb20.cmp.rdbms.RDBMSBean.processDescriptors(RDBMSBe
an.java:1105)
[ejbc] atweblogic.ejb20.cmp.rdbms.Deployer.readTypeSpecificData(Deploy
er.java:299)
[ejbc] atweblogic.ejb20.persistence.PersistenceType.setTypeSpecificFil
e(PersistenceType.java:490)
[ejbc] atweblogic.ejb20.persistence.PersistenceType.setupDeployer(Pers
istenceType.java:407)
[ejbc] atweblogic.ejb20.deployer.CMPInfoImpl.setup(CMPInfoImpl.java:11
4)
[ejbc] atweblogic.ejb20.ejbc.EJB20CMPCompiler.generatePersistenceSourc
es(EJB20CMPCompiler.java:64)
[ejbc] atweblogic.ejb20.ejbc.EJBCompiler.doCompile(EJBCompiler.java:22
3)
[ejbc] atweblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:3
44)
[ejbc] at weblogic.ejbc20.runBody(ejbc20.java:470)
[ejbc] at weblogic.utils.compiler.Tool.run(Tool.java:126)
[ejbc] at weblogic.ejbc20.main(ejbc20.java:711)
But if I put the "comments" <field-map> inside the VENDOR <table-map> andget
rid off the <table-map> for VENDOR_COMMENTS, I was able to run ejbc. Ofcourse,
I get the run time exception during deployment because, there is no columncalled
"VENDOR_COMMENT" in VENDOR table. Please help me. Thanks a million.
Similar Messages
-
Persisting CMP bean over more than one table
Hello,
I was wondering if it is possible to persist an Entity Bean over more than
one table using CMP. For example 3 attributes go in table A and 2 attributes
go in table B.
I can see this might come in handy when having some kind of inheritance in
your architecture.
Thanks,
Rein ReezigtCMP are based on one DB object however object could be a database table or a
view. You can create a view and base your bean on that view. This is mostly
useful for read-only entity beans that just do select queries because databases
have all kind of different restrictions on update froma view, ( for example
ORACLE allows update to only one table in view). However in case you need a
logical abstraction of multiple tables, consider EJB2.0 relations or a product
like toplink for your object to relational mapping.
Viresh Garg
Principal Developer Relations Engineer
BEA Systems
Rein Reezigt wrote:
Hello,
I was wondering if it is possible to persist an Entity Bean over more than
one table using CMP. For example 3 attributes go in table A and 2 attributes
go in table B.
I can see this might come in handy when having some kind of inheritance in
your architecture.
Thanks,
Rein Reezigt -
Entity bean for more than one table
Can an entity bean represent more than one phyical table in the database? (i.e. span tables) If so, how is it coded up?
Yes, probably either using BMP entity beans, or creating a database view of the two tables.
However, the actual implementation depends a lot on your database and EJB container. Since I didn't see any details of these in your post, I suggest you research the documentation for both your EJB container and database.
[Of-course, I'm assuming that you are already using a database and EJB container :-]
Are you familiar with the following Web sites:
http://java.sun.com/j2ee/tutorial/1_3-fcs/
http://www.theserverside.com
Have you read the specification?
http://java.sun.com/j2ee/download.html
Hope this helps.
Good Luck,
Avi. -
Maps - how to set up more than one destination
In Mavericks 10.9.4, how do I use the system Maps application to set up more than one destination? I saw no way to add a 2nd destination to my route. I know I could set up several one-destination trips but that seems silly.
Send Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.
Feedback -
How do u save datas more than one table using net beans ide using JSF
Hi,
I am new to JSF.
I save / delete / update / New master table using POJO (Plain Old Java Objects), database - oracle and Toplink Persistence Unit.
How do u save data more than one table using net beans ide using JSF (I am using POJO) ?
and also Tell me the reference book for JSF.
Thanks in advance.
regards,
N.P.SivaSivaNellai wrote:
I am new to JSF.
So, I am using net beans IDE 6.1 from sun microsystem. It is a free software.No, you don't drag'n'drop if you're new to JSF. Switch to source code mode. Write code manually, with the help of IDE for the speed up.
So, please guide me the reference books, articles. I need the basic understanding of JSF, net beans IDE.[JSF: The Complete Reference|http://www.amazon.com/JavaServer-Faces-Complete-Reference/dp/0072262400] is a good book. The [JSF specification document|http://jcp.org/aboutJava/communityprocess/final/jsr252/index.html] is also a good reading to understand what JSF is and how it works. There are also javadocs and tlddocs of Sun JSF Mojarra. -
Failed to upgrade more than one table at same time
Hi
In Deployment Manager, I failed to upgrade more than one table at same time.
I tried to hightlight 4 tables and set the default action as Upgrade, and click File/Generate Deploy. It passed the code generation step then I click Deploy, they are all failed with no error message.
But they are all successful when I upgrade them one by one. Any one has any idea about this?
For the known reason, we have no choice to do the deployment with action of 'upgrade' through OMBPlus, instead, can only do that interactively through OWB Client. I can't imagine to ask our Production side DBA to upgrade 80 tables one by one. Or I have to use the generated scripts to do the upgrade, which will resulted in 'no deploy status updated' in OWB. Any help will be very appricated.
The version I'm using is OWB 10g.
Thanks,
DamingHi
First of all, Patrick's solution doesn't work for me. I didn't do cloning and there is no problem when check the WB tables.
Second, I think your solution is only good for the developing environment just to get tables upgrade via deployment manager. In most cases, when you do a new release on PROD environment you just exp/imp the MDL file from DEV to PROD and any developing is not recommended on PROD. But your approach is trying to manually the DB, and then EDIT the mapping to do the Reconcile and then deploy. Surely you can do that if you have full control on your PROD side. However, in my situation, I have no access to the PROD for the security reason and an DBA Operator of the Client is responsible to implement my Migration process on PROD by himself. -
Want to Know how to Join more than One Table
I want to SHOW search results based on the search conditions user enters the form (eg: oracle advance search form OTN)
In this case i have to link more than one table and i have fetch the query results based on the user entered conditions in the search form.
can you please guide/help me in how to write/map this query using TOPLINK API.
my query should be like this:
SELECT A.ORDER_NUMBER, B.SAPORDER_NUMBER, C.CUSTOMER_NAME FROM DEAL_QUOTE A, DEAL_SAPORDER B, DEAL_CUSTOMER C
WHERE A.DEAL_QUOTE_ID=B.DEAL_QUOTE_ID AND B.START_DATE = C.START_DATE AND C.END_DATE=B.END_DATE
expecting your valuable reply.
Thanks in advance
Regards
babuIm not sure this is what you wanted, but couldn't you use a named query in TopLink and then use ADF to display the results?
-
How to delete the double records connected to one or more than one tables in SQL 2008?
Hi
Can anyone please help me with the SQL query. I Im having a table called People with columns names: personno., lastname, firstname and so on. The personno. is having duplicate records,so all the duplicate records i have written with "double" in
the beginning of the numbers. I tried deleting these double records but they are linked to one or more than one tables. I have to find out, all the tables blocking the deleting of double person. And then create select statements which creates update statements
in order to replace the current id of double person with substitute id. (The personno. is in the form of id's in the database)
ThanksYou should not append "double" in the personno. When we append it will not be able to join or relate to other table. Keep the id as it is and use another field(STATUS) to mark as duplicate. Also we will require another field(PRIMARYID) against
those duplicate rows i.e the main or the primary personno.
SELECT * FROM OtherTable a INNER JOIN
(SELECT personno, status, primaryid FROM PEOPLE WHERE status = 'Duplicate') b
ON a.personno = b.personno
UPDATE OtherTable SET personno = b.primaryid
FROM OtherTable a INNER JOIN
(SELECT personno, status, primaryid FROM PEOPLE WHERE status = 'Duplicate') b
ON a.personno = b.personno
NOTE: Please take backup before applying the query. This is not tested.
Regards, RSingh -
Layout issue - More than one table sections on report?
Hello all
I am wondering if any of you know if there is a way to have more than one table or table field on a report.
I'm asking this because I'd like to include a large number of fields in one report, but then that makes the report hard to read (everything is on one long line).
I am wondering if there is a way to have more than one table section on a report so I could have the address information at the top of the report than have other additional information below the address. Basically I'm interested in making things easier to read for the user.Use Pivot tables to isolate the columns you want in each table in your report.
Mike L -
How can i update more than one table at a time?
i would like to update more than one table at a time. In Java Studio creator2 how can i do table updation?
Hi,
Please go through the below thread might be of help to you.
http://forum.sun.com/jive/thread.jspa?forumID=123&threadID=51839
RK -
How to insert into more than one table at a time also..
hi,
i am a newbee.
how to insert into more than one table at a time
also
how to get a autoincremented value of an id say transactionid for a particular accountid.
pls assume table as
transactionid accountid
101 50
102 30
103 50
104 35
i want 102 for accountid 30 and 103 for accountid 50.
thank u@blushadow,
You can only insert into one table at a time. Take a look here :
Re: insert into 2 tables
@Raja,
I want how to extract the last incremented value not to insert.Also, I don't understand your thread title... which was "how to insert into more than one table at a time also.. "
Insert, extract... ? Can you clarify your job ?
Nicolas. -
Oracle OUTER JOIN on more than one table
Hi!
Friends, please help with this urgent problem: How can an outer join be written on more than one table?
An SQL Server query:
SELECT * from a INNER JOIN b on a.id = b.id LEFT OUTER JOIN c ON c.id = a.id AND c.id = b.id
works fine with SQL SERVER
But Oracle query:
SELECT * from a,b,c WHERE a.id = b.id AND a.id = c.id (+) AND b.id = c.id (+)
gives an error: OUTER JOIN cannot be used on more than one table? Why?
I use OracleDriver from classes12.zip to connect to Oracle8i database.
Please, help!The Oracle 8i and later SQL reference reads that the following "join_types" are supported and under this syntax it does not limit the LEFT OUTER JOIN (syntax the same as SQLServer example in original note) to two tables as implied in these notes:
The join_type indicates the kind of join being performed:
Specify INNER to indicate explicitly that an inner join is being performed. This is the default.
Specify RIGHT to indicate a right outer join.
Specify LEFT to indicate a left outer join.
Specify FULL to indicate a full or two-sided outer join. In addition to the inner join, rows from both tables that have not been returned in the result of the inner join will be preserved and extended with nulls.
You can specify the optional OUTER keyword following RIGHT, LEFT, or FULL to explicitly clarify that an outer join is being performed. -
JDBC-XI-FILE scenario. How to extract data from more than one table in JDBC
Hi,
I was asked a question like in JDBC-XI-FILE scenario........ How to extract data from more than one tables (i.e from JDBC system) ?? What is the logic to do the same ??
I am not sure whether this is a valid question..........but any help in this regards is highly appreciated.
Regards
KumarHI,
Yes it can be possible ,please see the following links
JDBC Receiver with Oracle Stored Procedures
configuring jdbc adapter with multiple tables
RFC -> XI -> JDBC Scenario Updating Multiple Tables
/people/alessandro.berta/blog/2005/10/04/save-time-with-generalized-jdbc-datatypes
JDBC Adapter multiple Selects
https://www.sdn.sap.com/irj/sdn/advancedsearch?query=jdbc%20with%20multiple%20tables&cat=sdn_all
Regards
Chilla.. -
Crystal Report - More than one table from MySql
Hello, I am in need of help big time.
I have am using Visual Studio 2010 and Crystal Report 10.
The problem that I am incounting is that I am unable to retreive data from more than one table from a MySql database. I have been stuck on this for too long and need to hjump the hurdle.
I am using a MySql connection string, a dataset and a crystal report which is based on the dataset.
The main error that I am having is, the browser opens and a form appears saying "The report you requetsed requires further information" With the Server name: DataSetPropertiesDetials, while the User name and Password fields are then enabled.
I am guessing I am missing something in my code.
When I retreive data from one table the report is fine, but when I try to use more than one table it throws the error.
My Code is below and also attached:
Imports System.Data.SqlClient
Imports System.Configuration
Imports MySql.Data.MySqlClient
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Web
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim con As MySqlConnection
Dim rpt As New CrystalReport3()
Dim myReport As New ReportDocument
Dim myData As New DataSet
Dim cmd As New MySqlCommand
Dim cmdUser, cmdProperty, cmdBranch As New MySqlCommand
Dim daBranch, daProperty, daUser As New MySqlDataAdapter
con = New MySqlConnection()
'Connection String
con.ConnectionString = "Server=****;Database=***;UID=***;Password=****"
Try
con.Open()
cmdBranch.CommandText = "SELECT branch FROM tblbranch"
cmdBranch.Connection = con
daBranch.SelectCommand = cmdBranch
daBranch.Fill(myData)
cmdProperty.CommandText = "SELECT ref, keys_held, key_no, keys_out, no_name, address_line1, address_line2,key_label FROM tblproperty"
cmdProperty.Connection = con
daProperty.SelectCommand = cmdProperty
daProperty.Fill(myData)
cmdUser.CommandText = "SELECT known_name FROM tbluser"
cmdUser.Connection = con
daUser.SelectCommand = cmdUser
daUser.Fill(myData)
myReport.Load("REPORT LOCATION")
myReport.SetDataSource(myData)
myReport.Database.Tables(0).SetDataSource(myData.Tables(0))
CrystalReportViewer1.ReportSource = myReport '
Catch myerror As MySqlException
MsgBox(myerror.Message)
End Try
End Sub
End ClassHi,
You have 3 SQL commands but you are calling SetDataSource only once. You need to look through for each of the SQL Commands.
Good luck,
Brian -
Update in JDBC Sender adapter for more than one table
Dear Friends,
I have to select more than one table in the JDBC sender using the join condition. But i found that update statement is also mandatory in the sender comm channel. I am not going to update any flag after the select but as it is mandatory, i have decided to use the following update statement which wont effect the existing data UPDATE <tablename> set flag = ' ' where flag = ' '.
But in my case i have 3 tables, do i need to update stmts for all the three tables.
if yes how can i do the same.
plz revert back i u couldnt get the queries.
Thanks
PremHI
UPDATE T1
Set T1.flag =1
where T1.columnA=value1 and T2.columnB=value2
where T1 and T2 are tables in the same database,
and the values (value1 and value 2 ) are provided to XI by SAP based on which the flag need to be updated in T1
write a stored procedure specifying the join and call it in XI.
For doing it in SQL statement only reffer to the below link ..sur you will get help .
Multiple records update using JDBC
Regard's
Chetan Ahuja
Maybe you are looking for
-
Is there a way to make DVD's with DVD menu's in Motion 5?
if so do you think this could be the alternative to the missing DVDSP?
-
Fan Speeds and Temperatures 24" iMac 2.8GHz
What are the default fan speeds for a 24" iMac 2.8 GHz? Also, what are the 'normal' temperatures for this computer?
-
Entry Point Not Found (Illustrator)
I got this error when i was starting up my Adobe Illustrator CC, It says there. "The procedure entry point AMTRetrieveLibraryPath could not be located in the dynamic link library amtlib.dll" Can someone help?
-
Premier Elements V 3.0.2 won't start?
When I click on the icon, the title page shows up and it starts loading but after about 5 seconds the title page disappears and the program does not start. I removed end reinstalled from disk and that solved the problem for a while but it has return
-
What is the defference between Statement & PreparedStatement?
Tell me some features of both! I don't know what the defferences is between them! Which should i use?