-->
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.  [ 11 posts ] 
Author Message
 Post subject: Enumeration type versus WebServices
PostPosted: Fri Jun 04, 2004 10:09 am 
Regular
Regular

Joined: Fri Nov 21, 2003 10:23 am
Posts: 81
I have pojo object that have property that is enumeration type. Because PersistentEnum is no longer supported by Hibernate, I must use Custom Type. But there is a problem, because Custom Type must implement UserType interface, where java specific classes are used and this results in problem transfering such class through WebServices.

How to solve this problem? Any help?

Tnx lot.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 10:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Do not let your Enum classes implement UserType, use a seperate class.


Top
 Profile  
 
 Post subject: how to map
PostPosted: Fri Jun 04, 2004 10:38 am 
Regular
Regular

Joined: Fri Nov 21, 2003 10:23 am
Posts: 81
Ok, but how I will use enum type in pojo and how I will map this enum type to db?

Now I have enum type:
Code:
public class BooleanType implements UserType, MyEnum {


and in pojo I have:
Code:
    /**
     * @hibernate.property type="com.pxpfs.excom2.finance.domainmodel.BooleanType"
     */
    public BooleanType getReadOnly() {
        return readOnly;
    }



But if I create something like:
Code:
public class BooleanType implements MyEnum {


how will look snippet in pojo object?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 10:40 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You have two classes: MyEnum and MyEnumUserType. One is a plain Java class, using the Typesafe Enumeration design pattern and the other one is a Hibernate custom UserType that knows how to persist and load instances of MyEnum. MyEnum doesn't know anything about Hibernate.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: code snippet in pojo
PostPosted: Fri Jun 04, 2004 10:48 am 
Regular
Regular

Joined: Fri Nov 21, 2003 10:23 am
Posts: 81
Can you send me code fragment of pojo object that uses MyEnum and MyEnumUserType?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 10:51 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
There are several examples on the Wiki and we don't provide handholding.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: ok
PostPosted: Fri Jun 04, 2004 10:58 am 
Regular
Regular

Joined: Fri Nov 21, 2003 10:23 am
Posts: 81
Ok, so why you reply on my question?
There is no additional information for me...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 11:00 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Please, just go look at the wiki.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: ?
PostPosted: Fri Jun 04, 2004 11:13 am 
Regular
Regular

Joined: Fri Nov 21, 2003 10:23 am
Posts: 81
Sorry, but I have one more question, are you talking about this article:
http://www.hibernate.org/203.html


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 04, 2004 11:18 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Read http://www.hibernate.org/172.html before.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: Tnx
PostPosted: Fri Jun 04, 2004 12:04 pm 
Regular
Regular

Joined: Fri Nov 21, 2003 10:23 am
Posts: 81
It looks promising ;-)
Tnx


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 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.