-->
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: Code generation - change default HashSet to ArrayList
PostPosted: Wed Nov 22, 2006 6:23 pm 
Newbie

Joined: Wed Nov 22, 2006 11:51 am
Posts: 2
Hibernate version: 3
Hibernate Tools version: 3.2 beta8
Web Services : Axis 2
Name and version of the database you are using: MYSQL


Hi,

I'm newbee with hibernate and I have some problems. I try to developp Axis 2 Web Services. The web services are based on MYSQL database.
I use hibernate to have persistent classes and generate POJO code from the database.
Each web service implement a POJO generated class.

Ex: Content.java is mapped to Content table. I created a WSContent with methods like Content GetContentById(int id).
So in this sample the WS method return a POJO Content .

To generate the POJO code I use hibernate tools with Eclipse IDE. All the code generation appended well. But when I invoke the WSContent GetContentById method hosted by Axis 2, I have the following error:

Code:
Exception occurred while trying to invoke service method getContent
org.apache.axiom.om.OMException: java.lang.IllegalArgumentException: null rcl
   at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:199)


I read in the Axis documentation and mailling list than Axis 2 don't support Set object, but it support Array object.

When there is a one2many associassion in the table, hibernate tools generate automatically an HashSet object:

ex:
Code:
public class Content implements java.io.Serializable {
   private int idContend = 0;
   private Set<String> comments = new HashSet(0);


I read in the documentation that it is possible to use ArrayList instead of HashSet Collection.

I search in the documentation and in the forum, but no results.

So my question is how POJO code generation can automatically generate ArrayList instead of HashSet ?

Regards,


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 11:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
not possible (yet).

note, it is not the actual codegen that has the limitation but the reverse engineering.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 11:39 am 
Newbie

Joined: Wed Nov 22, 2006 11:51 am
Posts: 2
So that's mean I have to rewrite all generated code to change HashSet to ArrayList ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 11:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
...or fix the reverse engineering...
...or change the generated hbm.xml (if you use those) from <set> to <bag>

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