JBoss-Ide 1.2.2 Introduction (Hibernate) 2

zhaozj2021-02-16  49

JBoss-Ide 1.2.2 Introduction (Hibernate) 2:

5. After the completion, we will create a NUM's Hibernate property file to shoot Fibo Table in the database, right-click Tutorial Project -> 'New' -> 'Class', 'package' fill in 'tutorial.hibernate', Name fills in 'Num', then press 'Finish'. The Hibernate tab in the xdoclet is used in the xDoclet, because this example is used to use the Hibernate tag, so it is not particularly created for this hibernate tag template. And Hibernate ID is generated. Will use UUID, code as follows:

Package tutorial.hibernate;

/ **

* @Author patrick.ip

*

* @ hibernate.class table = "fibo"

* /

Public class num {

Private string id;

Private Double value;

Public num () {

}

/ **

* @ hibernate.id generator-class = "uuid.hex"

* /

Public string getId () {

Return ID;

}

Public void setid (String ID) {

THIS.ID = ID;

}

/ **

* @ hibernate.property

* @Return Double

* /

Public Double getValue () {

Return Value;

}

Public void setValue (double value) {

THIS.VALUE = VALUE;

}

}

Apply these two classes will first add Hibernate's Import: Fibobean.java in Fibobean.java

Package tutorial.ejb;

Import java.rmi.remoteexception;

Import java.util.iterator;

Import javax.ejb.ejbexception;

Import javax.ejb.sessionbean;

Import javax.ejb.sessionContext;

Import javax.ejb.createException;

// Hibernate Imports

Import tutorial.hibernate. *;

Import net.sf.hibernate.query;

Import net.sf.hibernate.Session;

Import net.sf.hibernate.transaction;

Import net.sf.hibernate.hibernateException;

转载请注明原文地址:https://www.9cbs.com/read-21974.html

New Post(0)