2。UserType
import java.io.Serializable;/**
* @Hibernate.class table="P_USERTYPE"
*/
public class UserType
implements Serializable{
private static final long serialVersionUID=1;
public Long id;
public String value;
public String memo;
public UserType() {
super();
// TODO Auto-generated constructor stub
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public Long getId() {
return id;
} public void setId(Long id) {
this.id = id;
} public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
import java.io.Serializable;/**
* @Hibernate.class table="P_USERTYPE"
*/
public class UserType
implements Serializable{
private static final long serialVersionUID=1;
public Long id;
public String value;
public String memo;
public UserType() {
super();
// TODO Auto-generated constructor stub
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public Long getId() {
return id;
} public void setId(Long id) {
this.id = id;
} public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
解决方案 »
- jboss发布错误,请高手指导指导。
- 本机连接oracle时正常,远程连接sqlserver时出错,
- Hibernate查询排序出现问题!
- 请问在别人的系统中添加一个子系统,为什么URI编码会受到改变
- 问一个关于STRUTS<bean:write>的问题
- 请教:Hibernate与中文字段名
- jbuilderx+tomcat+jsp的问题,送分100,谢谢大家,急
- 哪位大哥能把beanshell包发给我,公司限制了上网,只能上CSDN和google之类的网站
- using static language or dynamic language?
- Tomcat4.1.30下站点的建立问题
- log4j输出日志文件的问题,急!!!
- hibernate 小问题!高手们帮帮忙!小弟初学!
import java.io.*;
import junit.framework.TestCase;
import org.hibernate.*;
import org.hibernate.cfg.*;
import com.mdc.data.beans.user.*;
public class HibernateTest extends TestCase {
Session session = null;
protected void setUp(){
try {
File file = new File("Hibernate.cfb.xml");
Configuration config = new Configuration().configure(file);
SessionFactory sessionFactory =
config.buildSessionFactory();
session = sessionFactory.openSession();
}
catch (HibernateException e) {
e.printStackTrace();
}
}
protected void tearDown(){
try {
session.close();
System.out.println("close");
} catch (HibernateException e) {
e.printStackTrace();
}
}
public void testInsert(){
try {
UserType userType=new UserType();
userType.setMemo("");
userType.setValue("测试spring2");
session.save(userType);
session.flush();
System.out.println(userType.getId());
}
catch (HibernateException e) {
e.printStackTrace();
}
catch(Exception e){
e.printStackTrace();
}
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}}