-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: @ManyToOne with entities from several SessionFactories
PostPosted: Thu May 19, 2011 2:22 am 
Newbie

Joined: Thu May 19, 2011 1:35 am
Posts: 1
Location: Russian Federation, Tyumen
Greetings!

I have 2 SessionFactories which references on 2 different databases. In the first database stores tables with application data. In the second database stores reference data: all available cities, streets, etc. I had created Entities for two databases, 2 SessionFactories. All works, but separately.
Can I make @ManyToOne reference from Entity1 (UserAdressInfo table in the 1st database) on Entity2 (StreetReference table in the 2nd database) by annotations or xml?

If I use @JoinColumn and @ManyToOne(fetch=FetchType.EAGER) annotation on Street getter, then on schema validation hibernate throw exception:
org.hibernate.AnnotationException: @OneToOne or @ManyToOne on Entity1 references an unknown entity: Entity2

And its right, because SessionFactory1 does not include Entity2... Does any way to do @ManyToOne reference from Entity1 to Entity2 with FetchType.EAGER?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.