Hi,
I was creating an Ant task to do a ORM from a created DataBase with Hibernate Tools. I create annotated classes from database tables with this tool.
Using reversystrategy class I could set my custom names for relations (OneToOne, ManyToOne, etc.) using the method
Code:
public String foreignKeyToCollectionName(String keyname, TableIdentifier fromTable, List fromColumns, TableIdentifier referencedTable, List referencedColumns, boolean uniqueReference)
I could see that this works great.
Now I want to all my primary key will be named "id" in the classes generated. For example, if I have a database table "user" with
Code:
INTEGER myKey PRIMARY_KEY
VARCHAR(50) name
I want to create a class with the properties
Code:
Integer Id;
String name;
Note: I want to make this task general. A priori I don't know how many tables there is in the catalog I want to map, neither the tables names it contains or the primary keys names.
How can I do get this working?
Somebody can help me?
Thanks in advance.