Troy, I ran into the same problem. It seems to be a hibernate issue - that archetype uses an older version of hibernate that breaks with mysql. Change the version in your pom for hibernate (I don't remember the latest, maybe 3.4GA). I meant to post this a while ago, as it cost me an hour or more to figure out.
chris Troy Noble wrote: > I'm not even sure this is a Lift issue, could be Hibernate or Scala... > but here goes... > > I get one test failure in TestJPAWeb.scala when I use JPA with MySQL > (also confirmed with H2) with auto-increment id column. > > @Entity > class Author { > @Id > @GeneratedValue(){val strategy = GenerationType.AUTO} > var id : Long = _ > ... > } > > Note that I also tried adding @Column{val nullable = false, val > insertable = false, val updatable = false} per another JPA+Scala page > I read, just to see if it makes a difference. It didn't. I also > tried GenerationType.IDENTITY. No difference. > > If I turn on showSql it appears that auto-increment columns are > getting included in the SQL statement for some reason such as: > > insert into author (name, id) values (?, ?) > > And I get an error indicating no value is set for column 2. The > Hibernate output using H2 database appears in spa/target/surefire- > reports/com.foo.jpaweb.model.TestJPAWeb-output.txt is as follows: > > Hibernate: insert into Author (name, id) values (?, ?) > Oct 31, 2009 7:05:48 AM org.hibernate.util.JDBCExceptionReporter > logExceptions > WARNING: SQL Error: 90012, SQLState: 90012 > Oct 31, 2009 7:05:48 AM org.hibernate.util.JDBCExceptionReporter > logExceptions > SEVERE: Parameter #2 is not set; SQL statement: > insert into Author (name, id) values (?, ?) [90012-121] > > A similar problem was reported in Hibernate 3.2.4 but was fixed in > 3.2.6... so I'm assuming version 3.3.1GA that Liftweb presently uses > should not be the source of this problem? That might not be a good > assumption. I was going to try to do a stand-alone Scala + JPA test > case apart from Lift, and then try with Java + JPA. > > But before I go too far down that path, I wanted to make sure I'm not > doing something wrong or that it's not a lift issue. > > This is very easy to reproduce if you start by downloading a clean > JPADemo as per the liftweb + JPA wiki page (or the liftbook example) > and change the top level pom.xml to include: > > <dependency> > <groupId>com.h2database</groupId> > <artifactId>h2</artifactId> > <version>1.2.121</version> > </dependency> > > or for MySQL: > > <dependency> > <groupId>mysql</groupId> > <artifactId>mysql-connector-java</artifactId> > <version>5.0.8</version> > </dependency> > > And then change the following entries in the spa/src/main/resources/ > META-INF/persistence.xml to target an h2 database instead of the > default derby: > > <property name="hibernate.dialect" > value="org.hibernate.dialect.H2Dialect"/> > <property name="hibernate.connection.driver_class" > value="org.h2.Driver"/> > <property name="hibernate.connection.url" > value="jdbc:h2:testDB"/> > > or if you want to use your local MySQL 5.0.x server instead (assumes > local DB named JPADemo exists, and is writable by user named lifdev > with password lift1234 (note the & is very important between the > username & the "password="): > > <property name="hibernate.dialect" > value="org.hibernate.dialect.MySQL5InnoDBDialect"/> > <property name="hibernate.connection.driver_class" > value="com.mysql.jdbc.Driver"/> > <property name="hibernate.connection.url" value="jdbc:mysql:// > localhost/JPADemo?user=liftdev&password=lift1234"/> > > Then "cd spa" and type "mvn clean install -Dscala.version=2.7.7" > > For what it's worth, if I open the H2 scheme with Squirrel SQL it all > looks happy from the schema creation side and has auto-increment in > the 'id' column. I can insert rows manually just fine. Similarly for > MySQL even for the newly-created tables 'author' and 'book'. > > Thanks, Troy > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---