-->
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.  [ 3 posts ] 
Author Message
 Post subject: hbm2java creating two default constructors
PostPosted: Tue Feb 07, 2006 4:00 pm 
Newbie

Joined: Tue Feb 07, 2006 3:33 pm
Posts: 2
Hibernate version:
Upgrading
from:hibernate-2.1.6 to:hibernate-3.0.2

Using HibernateTools-3.1.0.beta4


Problem
hbm2java creates a default constructor and a full constructor but they are both default constructors.


OrderType.hbm.xml:
Code:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
  "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
  <class name="OrderType">
    <id name="orderType" type="string">
      <generator class="native"/>
    </id>
  </class>
  <sql-query name="queryByOrderId">
    <return alias="ot" class="OrderType"/>
    select
      'Install' as {ot.orderType}
    from
      ... co
    where
      ...
      and co.ORDER_ID=:orderId   
  </sql-query>
</hibernate-mapping>



Ant build.xml:
Code:
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="classpath"/>

<target name="codegen" depends="init" description="Generate classes">
    <hibernatetool destdir="${src.dir}">
      <configuration propertyfile="hibernate.properties">
        <fileset id="hibernate.mapping.files" dir="${src.dir}">
      <include name="**/*.hbm.xml"/>
   </fileset>
      </configuration>
      <hbm2java/>
    </hibernatetool>
  </target>


Generated Pojo:
Code:
/**
* OrderType generated by hbm2java
*/

public class OrderType  implements java.io.Serializable {


    // Fields   

     private String orderType;


    // Constructors

    /** default constructor */
    public OrderType() {
    }

   
    /** full constructor */
    public OrderType() {
    }
   

   
    // Property accessors

    public String getOrderType() {
        return this.orderType;
    }
   
    public void setOrderType(String orderType) {
        this.orderType = orderType;
    }
   








}



Any ideas? THX.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 07, 2006 4:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
put a minimal (but complete) test case in jira

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 07, 2006 4:44 pm 
Newbie

Joined: Tue Feb 07, 2006 3:33 pm
Posts: 2
thx


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