-->
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: Hibernate Tools - ArrayList instead of HashSet - reveng.xml?
PostPosted: Tue May 15, 2012 12:56 pm 
Newbie

Joined: Tue May 15, 2012 12:52 pm
Posts: 1
Hello
I am newbie, i would like to genereate arraylist instead of hashset by hibernate tools in STS. I have found many topics...but without any good result:

now i have this in my reveng.xml file:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering
  SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering>
   <type-mapping>
      <sql-type jdbc-type="NUMERIC" precision='1' hibernate-type="boolean" />
      <sql-type jdbc-type="NUMERIC" hibernate-type="long" />
   </type-mapping>
</hibernate-reverse-engineering>


how can i easy to define genereate arraylists insteads hashsets?
thanks


Top
 Profile  
 
 Post subject: Re: Hibernate Tools - ArrayList instead of HashSet - reveng.xml?
PostPosted: Wed May 16, 2012 10:16 am 
Senior
Senior

Joined: Fri May 08, 2009 12:27 pm
Posts: 168
You Don't Want That (TM).

The only thing that the ArrayList does that a HashSet doesn't is that it imposes an ordering.
The problem is, you can't specify the order. Hibernate will fill the collection in whatever order it sees fit - it could be the order that the database delivers the rows, possibly modified by batching, current cache contents, or the phase of the moon.
You might get a useful ordering, or you might not, or any ordering that you observe might change as soon as you go from testing to production. You're essentially in the country of Undefined Behaviour.

What you can do is to use a Criteria or HQL query and specify the order there.
If the rows are already in Hibernate's cache, it should even avoid hitting the database.


Top
 Profile  
 
 Post subject: Re: Hibernate Tools - ArrayList instead of HashSet - reveng.xml?
PostPosted: Mon Oct 14, 2013 10:55 am 
Newbie

Joined: Mon Oct 14, 2013 10:51 am
Posts: 1
Is there an easy way to do it anyway?

thx in advance


Top
 Profile  
 
 Post subject: Re: Hibernate Tools - ArrayList instead of HashSet - reveng.xml?
PostPosted: Mon Oct 14, 2013 11:52 am 
Senior
Senior

Joined: Fri May 08, 2009 12:27 pm
Posts: 168
I doubt there is an easy way to do anything with Hibernate tools anymore.
Unless you're using JBoss Tools, that is - these seem to have migrated to Dali since at least 4.1.

Hibernate Tools 3.6 was horrible. It gave us 90% of what we needed in 10% of the time, but required 900% to get to 95% and utterly failed on the last 5%.
In the end, we cut our losses and have been using Dali, let it generate skeletons for the entity classes, then adapt these to what we need. It's far from ideal but at least it has been working, and we do not do THAT much of reverse engineering anyway.


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.