Issue 1:
Jack Woods opened SPR-7895 and commented

Custom message converters registered with AnnotationMethodHandlerAdapter are not used, only the default ones registered with <mvc:annotation-driven /> are used. I found that the setMessageConverters() method of AnnotationMethodHandlerAdapter class is called two times, one for the default and another one for the bean defined in the spring xml file. The one defined in the spring xml file is never used when doing actual marshalling and unmarshalling.

For example the following jibx message converter is not used:

<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">

<property name="messageConverters">

<util:list id="beanList">

<ref bean="marshallingHttpMessageConverter" />

</util:list>

</property>

</bean>

<bean id="marshallingHttpMessageConverter" class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">

<constructor-arg ref="jixbUserMarshaller" />

<property name="supportedMediaTypes" value="text/xml" />

</bean>

<oxm:jibx-marshaller id="jixbUserMarshaller" target-class="com.company.restpoc.model.User" />

In my opinion the jibx support in Spring OXM is rather poor. We need to define a separate converter for each target-class. We don't need to do that kind of thing when using Jersey with Jibx. We just need two @Provider classes that implement MessageBodyReader and MessageBodyWriter. I have attached JIBXBodyReader and JIBXBodyWriter for your reference.

Affects: 3.0.5

Reference URL: http://forum.springframework.org/showthread.php?t=100244

Attachments:

JIBXBodyReader.java (1.41 kB)

JIBXBodyWriter.java (1.57 kB)

Issue 2:
Frank Titius opened SPR-2406 and commented

If you try to persist a new object (insert) with duplicate key you get:

org.springframework.dao.InvalidDataAccessResourceUsageException: Could not invoke JDO makePersistent(Object) method; nested exception is javax.jdo.JDODataStoreException: Insert request failed: INSERT INTO ACCOUNT (CITY,STATUS,PHONE,COUNTRY,EMAIL,LANGUAGE_PREFERENCE,LAST_NAME,ZIP,ADDRESS2,USERID,ADDRESS1,FIRST_NAME,PASSWORD) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)

NestedThrowables:

java.sql.SQLException: Duplicate entry 'a' for key 2

Caused by: javax.jdo.JDODataStoreException: Insert request failed: INSERT INTO ACCOUNT (CITY,STATUS,PHONE,COUNTRY,EMAIL,LANGUAGE_PREFERENCE,LAST_NAME,ZIP,ADDRESS2,USERID,ADDRESS1,FIRST_NAME,PASSWORD) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)

at org.jpox.store.rdbms.request.InsertRequest.execute(InsertRequest.java:412)

at org.jpox.store.rdbms.table.ClassTable.insert(ClassTable.java:2379)

at org.jpox.store.StoreManager.insert(StoreManager.java:775)

at org.jpox.state.StateManagerImpl.internalMakePersistent(StateManagerImpl.java:3512)

at org.jpox.state.StateManagerImpl.makePersistent(StateManagerImpl.java:3485)

at org.jpox.AbstractPersistenceManager.internalMakePersistent (AbstractPersistenceManager.java:1146)

at org.jpox.AbstractPersistenceManager.makePersistent(AbstractPersistenceManager.java:1201)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at org.springframework.orm.jdo.JdoTemplate$9.doInJdo(JdoTemplate.java:406)

at org.springframework.orm.jdo.JdoTemplate.execute(JdoTemplate.java:259)

at org.springframework.orm.jdo.JdoTemplate.makePersistent(JdoTemplate.java:403)

at improvit.web.skill.dao.jdo.JdoAccountDao.storeAccount(JdoAccountDao.java:48)

at improvit.web.skill.dao.jdo.JdoAccountDao.insertAccount(JdoAccountDao.java:52)

at improvit.web.skill.domain.logic.WebSkillImpl.insertAccount(WebSkillImpl.java:111)

at improvit.web.skill.test.dao.AbstractAccountDaoTests.testDuplicateAccount(AbstractAccountDaoTests.java:123)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at junit.framework.TestCase.runTest(TestCase.java:154)

at junit.framework.TestCase.runBare(TestCase.java:127)

at improvit.web.skill.test.dao.ConditionalTestCase.runBare(ConditionalTestCase.java:69)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at junit.framework.TestResult.runProtected(TestResult.java:124)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at junit.framework.TestSuite.runTest(TestSuite.java:208)

at junit.framework.TestSuite.run(TestSuite.java:203)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

NestedThrowablesStackTrace:

java.sql.SQLException: Duplicate entry 'a' for key 2

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)

at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1124)

at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:676)

at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:773)

at org.jpox.store.rdbms.ParamLoggingPreparedStatement.execute(ParamLoggingPreparedStatement.java:213)

at org.jpox.store.rdbms.request.Request.executeUpdate(Request.java:88)

at org.jpox.store.rdbms.request.InsertRequest.execute(InsertRequest.java:283)

at org.jpox.store.rdbms.table.ClassTable.insert(ClassTable.java:2379)

at org.jpox.store.StoreManager.insert(StoreManager.java:775)

at org.jpox.state.StateManagerImpl.internalMakePersistent(StateManagerImpl.java:3512)

at org.jpox.state.StateManagerImpl.makePersistent(StateManagerImpl.java:3485)

at org.jpox.AbstractPersistenceManager.internalMakePersistent(AbstractPersistenceManager.java:1146)

at org.jpox.AbstractPersistenceManager.makePersistent(AbstractPersistenceManager.java:1201)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at org.springframework.orm.jdo.JdoTemplate$9.doInJdo(JdoTemplate.java:406)

at org.springframework.orm.jdo.JdoTemplate.execute(JdoTemplate.java:259)

at org.springframework.orm.jdo.JdoTemplate.makePersistent(JdoTemplate.java:403)

.... (rest omitted)

A "duplicate key" error should be translated to a DataIntegrityViolationException.

Possible cause: First JPOX wraps a JDODataStoreException around the SQLException.

Than reflection wrapped an InvocationTargetException and in JdoTemplate.makePersistent(..) the InvocationTargetException is caught which will prevent the translation in JdoTemplate.execute(..).

Possible solution for ALL "catch (InvocationTargetException ex) " in JdoTemplate:

before:

catch (InvocationTargetException ex) {

throw new InvalidDataAccessResourceUsageException(

"Could not invoke JDO makePersistentAll(Collection) method", ex.getTargetException());

}

after:

catch (InvocationTargetException ex) {

if (ex.getTargetException() instanceof JDOException)

throw (JDOException) ex.getTargetException();

else

throw new InvalidDataAccessResourceUsageException(

"Could not invoke JDO makePersistentAll(Collection) method", ex.getTargetException());

}

Affects: 1.2.8, 2.0 RC2, 2.0 RC3