views:

1258

answers:

2

i try to execute these 3 statements, 1 and 2 success, but when reach 3 statement, i get error, is it because i trying to insert into same table during statement 2 and cause statement 3 fail? by the way, all 3 statement is inside one @spring transaction

session.createSQLQuery(" select groupid from group_ where groupid = 888880005").executeQuery;//executed ok

session.createSQLQuery(" insert into layoutset (layoutsetid,groupid,companyid,privatelayout,logo,logoid,themeid,colorschemeid, wapthemeid,wapcolorschemeid,pagecount) values (888880005, 888880005, 1,0,0,0,'classic','03','mobile','01',0) ").executeUpdate();//executed ok

session.createSQLQuery(" insert into layoutset (layoutsetid,groupid,companyid,privatelayout,logo,logoid,themeid,colorschemeid, wapthemeid,wapcolorschemeid,pagecount) values (888890005, 888880005, 1,0,0,0,'classic','03','mobile','01',0) ").executeUpdate(); //this fail with

com.liferay.portal.kernel.dao.orm.ORMException: could not execute native bulk ma
nipulation query
        at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(Ex
ceptionTranslator.java:41)
        at com.liferay.portal.dao.orm.hibernate.SQLQueryImpl.executeUpdate(SQLQu
eryImpl.java:70)
        at com.company.service.companyPersistenceImpl.doTest(companyPersistenceI
mpl.java:53)
        at com.company.service.companyLocalServiceImpl.doTest(companyLocalServic
+1  A: 

the two inserts are exactly the same (same values for columns layoutsetid,groupid,companyid,privatelayout); the failure is due to a key-constraint I guess. what is the primary key of your table?

Henrik
tatement 2 and 3 are different, check the primary key 888880005 and 888890005
cometta
+1  A: 

Have you included the entire stacktrace? Seems to be some lines missing there.

However besides the different layoutsetid the two last queries are the same, which is pretty pointless. Probably there are some database constraints on the table to prevent this which result in the error.

NickDK
statement 2 and 3 are different, check the primary key 888880005 and 888890005
cometta
That's what I said right? Only the primary key is different.
NickDK