max wrote:
why would you want the id and not the object when you are using hibernate ?
Long story. Maybe at some point I will want the object but even then I want it named on the name of the foreign key and not the reference class. Because of multiple references.
I want to avoid this
Code:
public class User
{
Group group1;
Group group2;
}
I'd rather have
Code:
public class User
{
Group coolGroup; // foreign key COOL_GROUP_ID
Group anotherGroup;
}
Quote:
if you still want the naming stuff then look at ReverseEngineeringStrategy - you can create a Defaultreverseengineeringstrategy and call columnToPropertyName
Ah yes, that's what I've been looking for. Thank you. It was documented too :-)
Only one problem. If I change the strategy, the table filters from reveng.xml and all other parameters of the ant task stop working. Even though I inherit from DefaultReverseEngineeringStrategy.
I'm using hibernate-tools-3.0.0.alpha4a at the moment. Would the latest from CVS be any different?
On a different note, is there any way to influence the generation of these composite ids? Specifically if I reverse engineer a view, I get two classes: MyView.java - pretty empty - and MyViewId.java. MyViewId contains ALL the fields as composite id, which is not what I want.
Maybe a default name for the primary key, when none is found?