-->
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.  [ 3 posts ] 
Author Message
 Post subject: code generation for tables in different schemas
PostPosted: Thu Sep 06, 2007 8:55 pm 
Beginner
Beginner

Joined: Mon Jul 09, 2007 2:21 pm
Posts: 24
I am using hibernate.reveng.xml to generate pojos for 2 tables that i have that are located in 2 different schemas.

Table1 - schema1
Table2 - schema2

Table2 doesnt have a foreign key referencing Table1. but there is an implicit relationship...so i want the proxy object and association created in the pojos..

To accomplish the above, i added the following entry in reveng.xml

<table name="Table2" schema="schema2"
<primary-key>
---------
</primary-key>
<foreign-key constraint-name="Table2_FK"
foreign-schema="schema1"
foreign-table="Table1">

<column-ref local-column="Test1_ID" foreign-column="ID"/>
<many-to-one property="TestExt" exclude="false"/>
<set property="Tests"/>
</foreign-key>
</table>

Moreover, i dont want the generated hbm files to have refernce to Schema name... So, i added default_schema property in hibernate.cfg.xml file

After the code generation, i could nt see the proxy object and association generated as part of the pojo. (i dont see the HashSet and proxy object)

But if i remove default_schema property from hibernate.cfg.xml, and generate the code, i do see the association and proxy...
then again, this doesnt solve my purpose, because this adds the schema name in hbm.xml file

Max/Anyone, can you help resolve this?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 07, 2007 1:09 pm 
Beginner
Beginner

Joined: Mon Jul 09, 2007 2:21 pm
Posts: 24
can someone help me on this


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 12, 2007 9:38 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if the hbm.xml won't have schema listed for at least one of these tables how is hibernate going to find the table(s) that are not in the default schema ?

_________________
Max
Don't forget to rate


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

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.