-->
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.  [ 2 posts ] 
Author Message
 Post subject: how to create table through Hbm.xml file
PostPosted: Thu Apr 10, 2008 5:04 am 
Newbie

Joined: Thu Dec 27, 2007 4:03 am
Posts: 3
hi to all,

how can i create table through hbm.xml and bean(java file)
it is possible
coz
we r able to create hbm.xml file and bean file with the help of table through hibernate reverse engineering


Hibernate version:3.1

my hbm file is:-Feedback.hbm.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="fr.Feedback" table="FEEDBACK" schema="PC2">
<id name="feedbackId" type="java.lang.Long">
<column name="FEEDBACK_ID" precision="22" scale="0" />
<generator class="assigned" />
</id>
<property name="fname" type="java.lang.String">
<column name="FNAME" length="50" />
</property>
<property name="lname" type="java.lang.String">
<column name="LNAME" length="50" />
</property>
<property name="orgname" type="java.lang.String">
<column name="ORGNAME" length="500" />
</property>
<property name="address" type="java.lang.String">
<column name="ADDRESS" length="500" />
</property>
<property name="email" type="java.lang.String">
<column name="EMAIL" length="100" />
</property>
<property name="phone" type="java.lang.String">
<column name="PHONE" length="100" />
</property>
<property name="suggestion" type="java.lang.String">
<column name="SUGGESTION" length="4000" />
</property>
<property name="subdate" type="java.util.Date">
<column name="SUBDATE" length="7" />
</property>
</class>
</hibernate-mapping>










java bean is Feedback.java


package fr;

import java.util.Date;


/**
* Feedback generated by MyEclipse - Hibernate Tools
*/

public class Feedback implements java.io.Serializable {


// Fields

private Long feedbackId;
private String fname;
private String lname;
private String orgname;
private String address;
private String email;
private String phone;
private String suggestion;
private Date subdate;


// Constructors

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

/** minimal constructor */
public Feedback(Long feedbackId) {
this.feedbackId = feedbackId;
}

/** full constructor */
public Feedback(Long feedbackId, String fname, String lname, String orgname, String address, String email, String phone, String suggestion, Date subdate) {
this.feedbackId = feedbackId;
this.fname = fname;
this.lname = lname;
this.orgname = orgname;
this.address = address;
this.email = email;
this.phone = phone;
this.suggestion = suggestion;
this.subdate = subdate;
}


// Property accessors

public Long getFeedbackId() {
return this.feedbackId;
}

public void setFeedbackId(Long feedbackId) {
this.feedbackId = feedbackId;
}

public String getFname() {
return this.fname;
}

public void setFname(String fname) {
this.fname = fname;
}

public String getLname() {
return this.lname;
}

public void setLname(String lname) {
this.lname = lname;
}

public String getOrgname() {
return this.orgname;
}

public void setOrgname(String orgname) {
this.orgname = orgname;
}

public String getAddress() {
return this.address;
}

public void setAddress(String address) {
this.address = address;
}

public String getEmail() {
return this.email;
}

public void setEmail(String email) {
this.email = email;
}

public String getPhone() {
return this.phone;
}

public void setPhone(String phone) {
this.phone = phone;
}

public String getSuggestion() {
return this.suggestion;
}

public void setSuggestion(String suggestion) {
this.suggestion = suggestion;
}

public Date getSubdate() {
return this.subdate;
}

public void setSubdate(Date subdate) {
this.subdate = subdate;
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 10, 2008 6:50 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
Use hbm2ddl hibernate tool to do schema export.
See hibernate tools documentation

_________________
Sukirtha


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