How to use composite entities which driven by different PU via hibernate

Hi experts,
There are 2 different persistence unit in my project.
PU_A: Application entities, that can execute all crud operations.
PU_B: This one has some views which contains outside data. I can just read data from here
But i want to create foreign key in some entities which are in PU_A by using immutable-entity which managed by PU_B persistence-unit.
If you could view on following snippets. I have IncomingPaperwork entity which is driven by PU_A and ProjectView which is driven by PU_B.
After i applied this issue; When deploy the application exception that is below occured :
30-Jan-2013 15:13:05 o'clock EET> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException:
     at weblogic.ejb.container.deployer.EJBModule$1.execute(EJBModule.java:326)
     at weblogic.deployment.PersistenceUnitRegistryInitializer.setupPersistenceUnitRegistries(PersistenceUnitRegistryInitializer.java:62)
     at weblogic.servlet.internal.WebAppModule.initPersistenceUnitRegistry(WebAppModule.java:411)
     at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:365)
     at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
     Truncated. see log file for complete stacktrace
Caused By: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.acme.model.entity.IncomingPaperwork.projectView references an unknown entity: com.acme.integrationmodel.entity.ProjectView
     at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:81)
     at org.hibernate.cfg.AnnotationConfiguration.processEndOfQueue(AnnotationConfiguration.java:456)
     at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:438)
     at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:309)
     at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1162)
     Truncated. see log file for complete stacktrace
>
[03:13:05 PM] #### Deployment incomplete. ####
Is there a way to achieve this? Any suggestions?
Thanks in advance
___persistence.xml___
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="PU_A" transaction-type="JTA">
<description>This unit manages all application entities</description>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/A_DS</jta-data-source>
<class>com.acme.model.entity.IncomingPaperwork</class>
<properties>
<property name="hibernate.jndi.url" value="t3://localhost:7101"/>
<!--DataSource-->
<property name="hibernate.connection.datasource"
value="jdbc/A_DS"/>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
<property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.use_sql_comments" value="true"/>
<property name="hibernate.current_session_context_class" value="jta"/>
<property name="hibernate.archive.autodetection" value="jar,class"/>
</properties>
</persistence-unit>
<persistence-unit name="PU_B" transaction-type="JTA">
<description>This unit manages all integration entities</description>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/B_DS</jta-data-source>
<class>com.acme.integrationmodel.entity.ProjectView</class>
<properties>
<property name="hibernate.jndi.url" value="t3://localhost:7101"/>
<!--DataSource-->
<property name="hibernate.connection.datasource"
value="jdbc/B_DS"/>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
<property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.use_sql_comments" value="true"/>
<property name="hibernate.current_session_context_class" value="jta"/>
</properties>
</persistence-unit>
</persistence>
___IncomingPaperwork.class___
import com.arsivist.structure.BaseEntity;
import com.acme.integrationmodel.entity.ProjectView;
import com.acme.model.entity.listener.EntityListener;
import com.acme.model.entity.listener.IncomingPaperworkListener;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity(name = "IncomingPaperwork")
@Table(name = "INCOMINGPAPERWORKS")
@SequenceGenerator(name = "INCOMINGPAPERWORK_SEQ", sequenceName = "INCOMINGPAPERWORK_SEQ", allocationSize = 1)
@EntityListeners( { EntityListener.class, IncomingPaperworkListener.class })
public class IncomingPaperwork extends BaseEntity
private Company company;
private ProjectView projectView;
public IncomingPaperwork()
entityName = "IncomingPaperwork";
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "INCOMINGPAPERWORK_SEQ")
@Column(name = "ID")
public int getId()
return id;
public void setId(int id)
this.id = id;
public void setCompany(Company company)
this.company = company;
@ManyToOne(targetEntity = com.acme.model.entity.Company.class, cascade = { })
@JoinColumn(name = "COMPANYID", nullable = false)
public Company getCompany()
return company;
public void setProjectView(ProjectView projectView)
this.projectView = projectView;
@ManyToOne(targetEntity = com.acme.integrationmodel.entity.ProjectView.class, cascade = { })
@JoinColumn(name = "PROJECTVIEWID")
public ProjectView getProjectView()
return projectView;
___ProjectView.class___
import com.arsivist.structure.BaseEntityView;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import org.hibernate.annotations.Immutable;
import org.hibernate.annotations.Subselect;
@Entity(name = "ProjectView")
@Immutable
@Subselect("SELECT * FROM ProjectView")
public class ProjectView extends BaseEntityView
private String code;
private String name;
public ProjectView()
entityName = "ProjectView";
public ProjectView(int id, String name)
entityName = "ProjectView";
this.id = id;
this.name = name;
@Id
@Column(name = "ID")
public int getId()
return id;
public void setId(int id)
this.id = id;
public void setCode(String code)
this.code = code;
@Column(name = "CODE")
public String getCode()
return code;
public void setName(String name)
this.name = name;
@Column(name = "NAME")
public String getName()
return name;
@Override
public String toString()
return "" + getName();
Edited by: webyildirim on Jan 30, 2013 5:36 AM

Not quite what I meant - I was suggesting you load the entity immediately after reading it from PU_B, or anytime before associating it into PU_A, so before the merge. What you have not shown though is any code on how you are obtaining IntegrationDepartment and integrating it into PU_A, or what you mean by it is returning a refreshed version of Topic. This problem could also be the result of how your provider works internally - this is a TopLink/EclipseLink forum post so I cannot really tell you why you get the exception other than it would be expected to work as described with EclipseLink as the JPA provider.
So the best suggestions I can come up with are prefetch your entity, try posting in a hibernate forum, or try using EclipseLink/TopLink so someone here might be better able to help you with any problems that arise.
Best Regards,
Chris

Similar Messages

  • How to use the DLLs which created from c++ in Java?

    And How to use the DLLs which created from JNI in C++?

    Huh?
    Are you asking how to do JNI - you should read the tutorial.
    Are you asking how to load it - then use System.loadLibrary()
    Are you asking what to do with the output from javah - put it in a C file and write some code, compile it into a dll.

  • How to use xml forms which are built by using xml forms builder?

    Hi Experts,
    please explain How to use xml forms which are built by using xml forms builder in Web page composer?
    Thanks,
    Anil.

    hi buddy u can try the following page:
    http://help.sap.com/saphelp_nw70/helpdata/en/8f/fe743c74fa6449e10000000a11402f/frameset.htm

  • How to use the same OC4j server with different port number

    How to use the same OC4j server with different port numbers..?
    I have to OC4J installed on my machine on different hard disk drives....
    I want to be able to run both the server simultaneously..?
    is it possible ..it yes then how..?
    for that i have changed the port number of one server...
    but when i am trying to start the other server with different port number..it says that JVM -Bind already...
    Is there any clues...?
    Nilesh G

    In the config directory:
    default-web-site.xml: Change the port the HTTP listener listens on
    jms.xml: Change the port the JMS service listens on
    rmi.xml: Change the port the ORMI listener listens on.
    Or, you can add another web-site.xml file, and deploy your applications to 1 server, and bind the web applications to the different web sites. This way you only have to deploy your applications to 1 place.
    Rob
    Oracle

  • How to use same RESULT SET for two different events

    hello friends,
    I need to use same result set for two different events. How to do it.
    here My code,
    private void jComboBox1ItemStateChanged(java.awt.event.ItemEvent evt) {
    // TODO add your handling code here:
    try
    String selstate,selitem;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:tourismdatasource","sa","");
    selstate="select * from tab_places where state=?";
    PreparedStatement ps=con.prepareStatement(selstate);
    ps.setString(1, jComboBox1.getSelectedItem().toString().trim());
    ResultSet rs=ps.executeQuery();
    if(rs.next())
    jTextField1.setText(rs.getString("place_ID"));
    jTextField2.setText(rs.getString("place_name"));
    jTextField3.setText(rs.getString("category"));
    byte[] ba;
    ba=rs.getBytes("image");
    ImageIcon ic = new ImageIcon(ba);
    jLabel6.setIcon(ic);
    in=true;
    catch(ClassNotFoundException cfe){JOptionPane.showMessageDialog(null, cfe.getMessage());}
    catch(SQLException sqe){JOptionPane.showMessageDialog(null,sqe.getMessage());}
    Now i need the same Result Set(rs), in another event(jButton6ActionPerformed),
    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    }  how do i get dat resultset,
    help me out

    One post wasn't enough?
    {color:0000ff}http://forum.java.sun.com/thread.jspa?threadID=5246634{color}
    db

  • How to use Stock Category Group for two different configuration.

    Hi all,
    I want to use the stock category group to do this scenario:
    I have two process using the same location, the process A wants to consider Stock cat. Grp. 'ZSW' (SAPAPO/LOC3) so it will consider Stock using CC, CF and CE. The process B wants to consider Stock Cat. Grp. 'ZST' to consider only CC.
    My doubt:
    How can I do that setup to make different things according the process? I tried to do something in Planning Area (SAPAPO/MSDP_ADMIN) but doesnu2019t work.
    Can anyone help me?
    Thanks,
    -Ralph Veiga

    Hi Ralph Veiga,
    Indeed the stock category group is define at location level...
    I think your answer involves macros more than PA settings.
    First I will suggest to split the stock key figure into 2: one for CC, one for the other.
    For the CC, use the standard (cetegory group with CC only on the location master)
    Now you need to populate the second key figure with CF and CE.
    You should be able to built a macro using function PHYSICAL_STOCK() to get what you want.
    For sure yuo first need a way to check if you want or not the CF and CE. Here implement your own logic for exemple base on your product characteristics with either MAT(), MAT_C(), MAT_EXTRA(), MATLOC_C()...
    Else you can use a Z function in the macro to collect this data, but it involves ABAP coding.
    PS: you don't actually need to split the key figure into to, but I think it helps with visibility...
    Regards
    Julien

  • How to use logon ticket in case of different user id with SAP R3

    Hi.
    I try to login from EP to SAP R/3 using Logon Ticket but
    My problem is that EP, R/3 user id is different.
    Is there any method to login SAP R/3 using Logon
    Ticket in case of different user ID ?
    Regards, Arnold.

    Hi Arnold,
    SAP Logon Tickets issued by the Portal contain two user ids, basically one for Java Systems and one for ABAP systems. See also note 843061 for details.
    You do not need passwords for the reference system, if the user mapping is maintained by the user administrator, and the UM property ume.usermapping
    .admin.pwdprotection is set to false, see http://help.sap.com/saphelp_nw04/helpdata/en/fe/d22a41b108f523e10000000a155106/frameset.htm. If you set the mapped user id programmatically, or if you retrieve it from an LDAP server, you also do not need to verify the ABAP password of the user (see https://media.sdn.sap.com/javadocs/NW04/SP12/ume/index.html and http://help.sap.com/saphelp_nw04/helpdata/en/0b/d82c4142aef623e10000000a155106/frameset.htm).
    Best regards,
    Joerg

  • How to use stored procedure which returns result set in OBIEE

    Hi,
    I hav one stored procedure (one parameter) which returns a result set. Can we use this stored procedure in OBIEE? If so, how we hav to use.
    I know we hav the Evaluate function but not sure whether I can use for my SP which returns result set. Is there any other way where I can use my SP?
    Pls help me in solving this.
    Thanks

    Hi Radha,
    If you want to cache the results in the Oracle BI Server, you should check that option. When you run a query the Oracle BI Server will get its results from the cache, based on the persistence time you define. If the cache is expired, the Oracle BI Server will go to the database to get the results.
    If you want to use caching, you should enable caching in the nqsconfig.ini file.
    Cheers,
    Daan Bakboord

  • How to use progress indicator which block the user for editing ?

    Hi All,
    I have a requirement where i need to show a round progress bar while processing to the database.For example :- I have a bounded taskflow and inside it I have a two jspx page called as "First.jspx" and "Second.jspx".And i have two textboxes and one "Save" button on first.jspx page.
    Now when user puts the values in the textboxes and hits the "Save" button , my ticker or progress indicator should say "Please wait while processing" and as soon as the transaction is complete , i need to show another page which is "Second.jspx" page. "Save" button action has method inside a managed bean which has some functionality and then it executes the VO(View Object) and commits the data.
    How should i implement the indicator?
    I have read this article :- http://www.oracle.com/technetwork/developer-tools/adf/learnmore/42-progressbarcolor-169184.pdf but it doesn't fit to my requirement.I need indicator which holds the user to edit anything on the page.Like what we get when we do any transaction in banks while navigating to payment gateway.
    Please suggest!!!
    Thanks and Regards,
    Shah

    Hi Shah,
    The answer was around the same are that you were looking into. http://www.oracle.com/technetwork/developer-tools/adf/learnmore/27-long-running-queries-169166.pdf but the sample was the 27.
    - Juan Camilo

  • How to use a map which is created in mapbuilder

    Hi ,
    I have created a map by using map builder and now i want to open in IE browser through map viewer, can any one guide me through this process please
    I have created few themes and base map in map builder , i can see my map in mapbuilder but how to open in IE
    Edited by: user12078402 on 24-Feb-2010 12:36

    To display map in browser you should use JavaAPI or JavascriptAPI from mapviewer

  • 2 Questions How to use join() and Which is best coding pratice.

    Hi All,
    I have 2 Question:
    I have a MultipleThread class and when I try to use join method of thread class I get compile time error(so i commented it out).I also wanted to know is the best approch to write a threaded program.I also wanted to know about the best coding pratice for threadand also do I need to declare Instance variable thread and name(Is it possible to create multiple thread with out declaring instance variable thread and name , if yes which one is the better way 1> with instance variable 2> with out instance variable)

    Sorry here is the code.
    package javaProg.completeReferance;
    public class MultipleThread implements Runnable
         Thread thread;
         String name;
         MultipleThread(String nam)
              this.name=nam;
              thread = new Thread(this,name);
              thread.start();
         public void run()
              try
                   for (int i=1;i<=10;i++ )
                        Thread.sleep(1000);
                        System.out.println("Thread "+name+" "+i);
              catch (InterruptedException e)
                   System.out.println(""+e);
         public static void main(String [] args)
              try
                   MultipleThread t1=new MultipleThread("One");
                   MultipleThread t2=new MultipleThread("Two");
                   MultipleThread t3 =new MultipleThread("Three");
                   //t1.join();
                   //t2.join();
                   //t3.join();
                   for (int i=1;i<=10;i++ )
                        Thread.sleep(1000);
                        System.out.println("Parent Thread "+i);
              catch (InterruptedException e)
                   System.out.println(" "+e);
    }

  • How to use the Events which are in BOR?

    HI Experts
    In SAP Business Object Repository, under each object, we can see some events. What are these events, can we use them in our programs. For instance the business object type BUS2010-Purchase order; I can see some events for it, If I want to use these events in my custom program, can I use them?
    What is the use of it SAP R/3. If you feel my question is baseless also, please provide me the information about this once.
    Thanks in advance
    Praveen

    Hi,
    If you want to raise BOR event from your program you can use function module SWE_EVENT_CREATE.
    If you want to register for the event and handle it you can go to transaction SWEC and register your function module there.

  • How IPAD use the Printer which connected with the Time Capsule

    I connnected a printer to time capsule. And I can use the printer in Windows. But I can't use it on IPAD and IPHONE.
    So are there any solutions?

    iOS devices can only print directly to AirPrint printers. Wireless printers or printers connected to a Time Capsule are not necessarily AirPrint capable.
    To print directly from an iPad / iPhone you will need an AirPrint compatible printer or another device to act as a print server. That can be a Mac computer running Printopia ($19.95 with free trial) or handyPrint (donation - supported). The Mac must be "on" but may be asleep for them to work. Equivalent PC options exist but you're on your own finding them.
    You can also buy this standalone print server:
    http://www.lantronix.com/it-management/xprintserver/xprintserver.html
    The xPrintServer Home Edition will support a directly connected USB printer. The Network Edition will support any network printer.
    These options enable you to use any printer available to your Mac, even older ones that may predate AirPrint by decades.
    Otherwise you will need to buy an AirPrint printer or multifunction device.

  • How to use one dataTable to dynamically assign different values?

    For example, there is only one popup window that contains one dataTable. For every commandButton that calls this popup window will result in different dataTables.
    How to do that?
    Thank you.

    I wanna reuse the same popup window page to display different dataTables with values based on which button(on father window) is clicked...
    I use an html to include the popup window like this:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <frameset>
    <frame src="popupMediaType.jsf" />
    </frameset>
    </html>
    So there will be two pages for one popup window...and I call this html by javascript in the father window...
    I wanna use just two pages to do all the work for other similar popup windows...

  • How to use Find my Mac on a different iCloud account?

    I have my own iCloud account set on my mac and on my iPhone, however on my iPhone, I manage to use my dad's iCloud account so he can use the find my iphone app on my phone. I do this while still having all other icloud stuff (eg. imessage or app store) with my own icloud account/apple id (not my dads). However I recently bought a macbook air and Im trying to set up the find my mac on icloud but for some reason, i can only have one icloud account at the same time, and i wanted to have my dads icloud/apple id for the find my mac and my own apple id for the rest of the stuff. Does anyone know how to do this?

    You can see the locations of your devices and take additional actions by going to http://www.icloud.com, then signing in and clicking on Find my iPhone.

Maybe you are looking for

  • Payment Run F110:  Message type PAYEXT / EUSPEXR

    Hi, For every payment run (transaction F110) for EDI Partner there's a generation of idoc (message type PAYEXT) containing all the information. Also there is another idoc get created (Message type EUSPEXR) containging the summary info. Is there a way

  • How do you get it out of recovery mode

    i cant get of the itunes screen and the pluging in sign to go away. i am singed in and lla dn it says to plug it in to m computer which i did, but it still isnt working. i feel like i have broken my phone and there is nothing else to do. and it says

  • Ipod nano 4th gen Equalizer won't enable

    I just nought the 4th gen of Ipod nano and am having problems getting the equalizer to enabel (go from 'off' to 'on) so I can add bass, use loudness or other options. Has anyone seen this and waht;s the fix. the online user guides arent much help.

  • Macbook pro: enough grunt to multicam edit off FW400 ext drive

    Have a rev A Macbook Pro with 1.5gig RAM. It seems to be choking on a two camera edit (one hour long) from media stored on a FW400 hd drive. It is reporting dropped frames etc

  • Easy setup for Digibeta?

    I realize this is probably really simple, but: I need to get my sequence out to Digi and every time I try the edit to tape i'm told i have "Incompatible compression settings"? I'm on FCP 6 going to a sony DVW-M2000P through a AJA IO (SD) and i'm usin