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.  [ 11 posts ] 
Author Message
 Post subject: Can 3.2beta6a support many-to-one relationship?
PostPosted: Fri Aug 18, 2006 6:04 pm 
Regular
Regular

Joined: Wed Mar 15, 2006 1:48 pm
Posts: 91
If so, where can I input multiple tables in ant env.?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 18, 2006 7:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
many-to-one ? sure, that has always been possible.

But I don't understand what your question is for. by default we reverse engineer all tables.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 19, 2006 12:10 am 
Regular
Regular

Joined: Wed Mar 15, 2006 1:48 pm
Posts: 91
I don't want to generate hbm for all tables in schema, and the table names should be dynamically input from ant prompt. In this case, how can I pass dynamical table names into revers eng xml file?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 19, 2006 3:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
generate a reveng.xml from your ant input and run it with that.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 19, 2006 4:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
or maybe even better implement a ReverseEngineeringStrategy that just do what you want (e.g. return the table names you want to accept) or provide a DatabaseMetaDialect that only returns those tables...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 19, 2006 5:50 pm 
Regular
Regular

Joined: Wed Mar 15, 2006 1:48 pm
Posts: 91
I prefer ant solution if it is applicable. In my case, I will have multi. table name input from ant prompt, say like "table_A, table_B". Then I need them shown in rev.eng.xml file for <table name="table_A">, <table name="table_B">. Hibernate tools will take care of generating hbm files and many-to-one relationship between table_A and table_B. Not sure how ant will work to generate dynamical rev.eng.xml file including these table names. Ant supports javascript, and I have used it to parse table names based on comma delimition. Do you have any idea? Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 19, 2006 7:33 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
all of this is possible via ant, you just need to implement a reveng strategy that gets your input e.g. via a property.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 20, 2006 11:24 pm 
Regular
Regular

Joined: Wed Mar 15, 2006 1:48 pm
Posts: 91
I know I can pass a @table.name@ in reveng.xml file, but not know how I can pass undetermined number of @table.name@ in it. Do you have any sample code for this case?

Do you mean wriete a reveng strategy which takes table names from a property file? That is a Java solution, not an ant one. I want to avoid creating a Java class if ant solution can do it.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 1:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
I don't have other suggestions than to write a custom strategy.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 1:05 pm 
Regular
Regular

Joined: Wed Mar 15, 2006 1:48 pm
Posts: 91
To generate many-to-one relationship, I have to specify something as below in reveng.xml file. I remember in middlegen, what I need is only provide table names and it takes care of parsing relationship among tables without specifying foreign key stuff. Can we have this feature in future release?

<foreign-key constraint-name="ORDER_CUST">
<many-to-one property="customer"/>
<set property="orders"/>
</foreign-key>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 3:36 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Huh? Hibernate Tools detects that fine today.

Same requirements as with middlegen: You need to have a driver and db that has the foreignkey constraints defined.

So, no you can't have it in a future release because its already there.

There is no need to specify these *unless* you want to

a) override some of the default values

b) define additonal foreign keys.

again, please be more specific ;)

_________________
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.  [ 11 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.