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;
}
}
|