-->
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.  [ 1 post ] 
Author Message
 Post subject: i want to cumtom type.TT-TT
PostPosted: Tue Apr 17, 2007 2:59 am 
Newbie

Joined: Tue Apr 03, 2007 5:42 am
Posts: 13
i'm super low level. so i can't this easy prolbelm. OTL..

i want to make usefull custom type at next mapping file.

Code:
<class name="ReservedContents" table="SYSTEM_CONTENTS">
      <id name="seq" column="SSC_CONTENTS_SEQ_FK">
         <generator class="native"></generator>
      </id>
      <property name="type" column="SSC_TYPE" type="ContentsEntryType">
         <column name="code" />
      </property>
      <property name="description" column="SSC_DESCRIPTION" />
   </class>


belowe code i smy java class.
plz, convert this class to custom type class.
Code:
public class ContentsEntryType {
   public static final ContentsEntryType CONTENTS = new ContentsEntryType("CONTENTS");
   public static final ContentsEntryType RECYCLEBIN = new ContentsEntryType("RECYCLEBIN");
   public static final ContentsEntryType WORKBIN = new ContentsEntryType("WORKBIN");
   
   private final String _code;
   
   private ContentsEntryType(String code) {
      this._code = code;
   }
   public String getCode() {
      return _code;
   }
   public String toString() {
      return _code;
   }
}


next is using example.
Code:
ReservedContents contents = new ReservedContents();
contents.setType(ContentsEntryType.RECYCLEBIN);
session.save(contetns);


thank you.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.