result « Insert « JPA Q&A





1. SET IDENTITY_INSERT tableName ON returns result of -1    forum.hibernate.org

Originally, I received the following error from Hibernate: 4340 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Cannot insert explicit value for identity column in table 'UserSynonym' when IDENTITY_INSERT is set to OFF. So I searched the Internet for solutions. Here is my table definition: I am ...

2. Inconsistency with insert results    forum.hibernate.org

Hibernate version:2.1.6 Mapping documents:None Code between sessionFactory.openSession() and session.close(): Code: public void testInitJobTasks(){ int times = 3; try{ java.util.Random random = new java.util.Random(); Job job= new JobList().getJob(new Long(1)); Tool tool= new JobList().getTool("ping"); Session s =HibernateUtility.getSession(new File(OperationHandler.GLOBAL_DATABASE_FILE)); for(int i=1;i<=times;i++){ JobProcess mJobProcess = new JobProcess(); ...

3. Inconsistency with insert results    forum.hibernate.org

Hibernate version:2.1.6 Mapping documents:None Code between sessionFactory.openSession() and session.close(): Code: public void testInitJobTasks(){ int times = 3; try{ java.util.Random random = new java.util.Random(); Job job= new JobList().getJob(new Long(1)); Tool tool= new JobList().getTool("ping"); Session s =HibernateUtility.getSession(new File(OperationHandler.GLOBAL_DATABASE_FILE)); for(int i=1;i<=times;i++){ JobProcess mJobProcess = new JobProcess(); ...

4. Strange insert result    forum.hibernate.org

Hibernate version 2.1.6 Weblogic version 8.1.3 Oracle 8.1.7 Using oracle jdbc thin driver. When create attachment, the parentID are floating number such as 2.53E-124, 1.46E56 Attachment attachment = new Attachment(); attachment.setName(name); attachment.setType(Attachment.TYPE_DOC); attachment.setLinkAlt(name); attachment.setParent(article); article.getAttachments().add(attachment); session.save(attachment); When runing on WebSphere, Tomcat, it's OK. The mapping file is below.