-->
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: hbm2java
PostPosted: Fri Dec 05, 2008 2:19 am 
Newbie

Joined: Fri Dec 05, 2008 2:03 am
Posts: 1
Location: India
Hibernate Version 3.2.4.sp1:

I tried to build POJOs with hbm2java of hibernate tools. It works perfect except in the following situation

Case 1) Works OK

<?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 package="com.test.web">

<class name="Test100" table="test100">
<id name="testId" column="testId" type="integer">
<generator class="native"></generator>
</id>

<property name="middleName" column="middleName" type="string" unique="true" ></property>
</class>


</hibernate-mapping>




package com.test.web;
// Generated Dec 4, 2008 8:50:04 PM by Hibernate Tools 3.2.0.b9



/**
* Test100 generated by hbm2java
*/
public class Test100 implements java.io.Serializable {


private Integer testId;
private String middleName;

public Test100() {
}

public Test100(String middleName) {
this.middleName = middleName;
}

public Integer getTestId() {
return this.testId;
}

public void setTestId(Integer testId) {
this.testId = testId;
}
public String getMiddleName() {
return this.middleName;
}

public void setMiddleName(String middleName) {
this.middleName = middleName;
}




}


Works ok.



Now case 2 )



Now I added <properties > ........ </properties>.




<?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 package="com.test.web">
<class name="Test100" table="test100">
<id name="testId" column="testId" type="integer">
<generator class="native"></generator>
</id>

<properties name="testUnique" unique="true" update="false">
<property name="firstName" column="firstName" type="string"></property>
<property name="lastName" column="lastName" type="string"></property>
</properties>


<property name="middleName" column="middleName" type="string" unique="true" ></property>
</class>


</hibernate-mapping>



package com.test.web;
// Generated Dec 4, 2008 8:53:43 PM by Hibernate Tools 3.2.0.b9



/**
* Test100 generated by hbm2java
*/
public class Test100 implements java.io.Serializable {


private String firstName;
private String lastName;

public Test100() {
}

public Test100(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}

public String getFirstName() {
return this.firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return this.lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}




}


In this case, it does not add properties testId, and middleName in generated POJO. Did I made any mistake or it is bug


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.