摘要:
1.查找对象 1)用find()方法查找对象public void getPerson(){ EntityManagerFactory factory = Persistence.createEntityManagerFactory("jpa"); EntityManager em = factory.createEntityManager(); //相当于Hibernate中的get方法 Person person = em.find(Person.class, 1); System.out.println(person.... 阅读全文
posted @ 2013-08-20 11:55
lhj588
阅读(1899)
评论(0)
推荐(0)
摘要:
1、数据库中字段的数据类型为longtext存放二进制文本的注解方式private byte[] file;//设置延迟初始化 @Lob @Basic(fetch=FetchType.LAZY) public byte[] getFile() { return file; } public void setFile(byte[] file) { this.file = file; }数据库中数据类型为longblob设置该属性与字段没有映射关系的注解方式private String Mail;@Transient public S... 阅读全文
posted @ 2013-08-20 11:53
lhj588
阅读(2725)
评论(0)
推荐(0)
摘要:
所需要的最小的jar包(注意:jar包所在路径不能含有空格或中文)hibernate3.jarhibernate-cglib-repack-2.1_3.jarslf4j-api-1.5.2.jarjavassist-3.4.GA.jarjta-1.1.jarantlr-2.7.6.jarcommons-collections-3.1.jardom4j-1.6.1.jarejb3-persistence.jarhibernate-annotations.jarhibernate-commons-annotations.jarhibernate-entitymanager.jarlog4j.jar 阅读全文
posted @ 2013-08-20 11:38
lhj588
阅读(476)
评论(0)
推荐(0)

浙公网安备 33010602011771号