-->
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.  [ 4 posts ] 
Author Message
 Post subject: reverse engineer list index
PostPosted: Mon Apr 14, 2008 10:32 am 
Newbie

Joined: Mon Apr 14, 2008 9:12 am
Posts: 2
I am new to hibernate. I would like to know if it is possible to do the following.

How to force reverse engineer to generate a List instead of a HashSet? I need the list to be ordered. I have an index column. I see that myclipse has a list.hbm.vm template but it does not seem to generate a List.

How to add a add method to a pojo class?

Basically I would like to generate the following.

void setItems(List items);

List getItems();

void addItem(Item item);


Steve

[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 14, 2008 1:06 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well the templates does not do the reverse engineering, it just generates code based on the Configuration.

So this would need some additional logic in the current reverse engineering ...care to submit a patch ? :)

p.s. myeclipse uses a forked/old version of hibernate tools.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 14, 2008 9:52 pm 
Newbie

Joined: Mon Apr 14, 2008 9:12 am
Posts: 2
Sure I would not mind submitting a patch. Any guidance on developement would greatly be appreciated. I have a lot of classes and it would probably be worth the effort.
I am really green to hibernate. I am looking to migrate from Castor.

Steve


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 15, 2008 1:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well it would require you got pretty good into hibernate.

Things that would need to be done:

Add unittests for the various models you want to support and see them fail ;)

Fix JDBCBinder so it will recognize which associations/foreign-keys that will be list's and what column should be used as the list-index (btw. if you do this you could just as well implement Map support too - but lets do that in the next rev ;)

JDBCBinder should use ReverseEngineeringStrategy to identify the type of collection and which column that should be used for the index/map-key.

Then you would need to check that list.hbm.ftl generates the correct code for hbm.xml and eventually also check the annotations generation to see if that generates the apropriate code.

At this point you would be able to do everything programmatically, but to be really complete it should be possible to control in reveng.xml, probably by allowing for a <list>/<map> element under foreign-key with info about which column is the index. This is done in OverrideBinder/OverrideRepository.

Let me know.

_________________
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.  [ 4 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.