-->
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: Overriding constructor definition in hbm.xml
PostPosted: Thu Dec 06, 2007 9:54 am 
Newbie

Joined: Thu Aug 10, 2006 7:43 am
Posts: 14
How can I override the automatic constructor generation in a hbm.xml file?

Using the following code results in an error that the construcotrs are already defined.

Code:
<meta attribute="class-code">
   public static final Integer MY_STATIC_ATTRIB_ID_1   = new Integer(1);
   public static final Integer MY_STATIC_ATTRIB_ID_2   = new Integer(2);

   public MyClass()
   {
      this.myAttribId = MyClass.MY_STATIC_ATTRIB_1;
      this.myAttribStr = MyClass.MY_STATIC_ATTRIB_1.toString();
   }//end default constructor
   
   public MyClass(Integer myClassAttribId)
   {
      this.myAttribId = ;
      switch ( myClassAttribId )
      {
         case 1: this.myAttribId = MyClass.MY_STATIC_ATTRIB_ID_1;
               this.myAttribStr = MyClass.MY_STATIC_ATTRIB_1.toString;
               break;
         case 2: this.myAttribId = MyClass.MY_STATIC_ATTRIB_ID_2;
               this.myAttribStr = MyClass.MY_STATIC_ATTRIB_2.toString;
         default: break;
      }
   }//end default constructor
   </meta>


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.