问题
A few days ago, I posted Roo 1.1.5 super basic application is buggy, and just recently on Dec 17, 2011, Spring Roo 1.2.0 has been released. I created the equivalent project:
project --topLevelPackage task --java 6 --projectName Task
jpa setup --provider DATANUCLEUS --database H2_IN_MEMORY
entity jpa --class ~.domain.Task
field string --fieldName description --notNull --sizeMin 3 --sizeMax 512
field boolean --fieldName completed --notNull
web jsf setup
controller all --package ~.controller
exit
mvn jetty:run
And I was greeted with java.lang.NoClassDefFoundError: javax/jdo/JDONullIdentityException
. Not a good start, but easy to solve adding the missing jdo-api dependency, in the pom.xml
(as Andy Datanucleus explained here)
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0</version>
</dependency>
At this point the application could run, but the duplicated record on update bug was still there. So, as explained in the JIRA ROO-1467, by Andy again, I've added to persistence.xml
:
<property name="datanucleus.allowAttachOfTransient" value="true"/>
This time I didn't get the duplicated record, but an exception:
Cannot set Object parameter: value = 1 for column "TASK.VERSION" : Invalid value "6" for parameter "parameterIndex" [90008-161]; nested exception is javax.persistence.PersistenceException: Cannot set Object parameter: value = 1 for column "TASK.VERSION" : Invalid value "6" for parameter "parameterIndex" [90008-161]
I don't know if relevant or not, but I've also noticed many warnings similar to the following one:
WARN DataNucleus.MetaData - Class task.controller.TaskController_Roo_Controller
was specified in persistence-unit persistenceUnit but not annotated, so ignoring
What other change should I do to make it work?
来源:https://stackoverflow.com/questions/8553495/roo-1-2-0-basic-application-with-datanucleus-still-buggy