Thank you Troy for the detailed ticket! A fix is up for review: http://reviewboard.liftweb.net/r/90/
slf4j-simple is preferred common denominator. slf4j-nop is self-defeating IMHO :) Good point regarding slf4j-log4j12 for legacy fallback. I have added an inline note in the POM. Cheers, Indrajit On 03/11/09 6:44 PM, Troy Noble wrote: > I think the slf4j-simple you suggest might work better than the > slf4j-nop I had settled upon. I just picked one out of the > slf4j-1.4.2.jar that didn't have any other downstream dependencies. I > am sure slf4j-nop does absolutely nothing (old school >/dev/null style > logging) whereas slf4j-simple might give simple stream based logging > which is probably preferred for troubleshooting at least. I'll need to > try it. > > I opened a new issue (#156) at Indrajit's request to get the pom.xml > updated in the Archetype. Will be interested to see which one he chooses. > > Thanks again, Troy > > On Tue, Nov 3, 2009 at 5:00 AM, Chris Lewis <burningodzi...@gmail.com > <mailto:burningodzi...@gmail.com>> wrote: > > > Troy, > > Glad that helped. You don't need to manually install log4j, you can > declare a dependency on the "simple" artifact: > > <dependency> > <groupId>org.slf4j</groupId> > <artifactId>slf4j-simple</artifactId> > <version>1.4.2</version> > </dependency> > > I think those simple tweaks (deps on hibernate 3.4 and sl4j) may fix the > JPA archetype woes, at least w/ mysql. > > > Troy Noble wrote: > > Yes I tried Chris's suggestion, and JPA does in fact work with > MySQL 5.0 > > with auto-increment ID columns even with columns named something > other > > than 'id' using @Column(val name="PROJECT_TYPE_ID") for example. > > > > Thanks Chris! > > > > I changed JPAWeb/spa/pom.xml dependency for > hibernate-entitymanager to > > version 3.4.0.GA <http://3.4.0.GA> <http://3.4.0.GA> and that > caused maven to grab all of > > its dependencies included an update hibernate-core 3.3.0.SP1 > which had > > the fix I needed. Since hibernate now appears to have some > dependency > > on org.slf4j, I was then getting an Exception... something about not > > being able to find org.slf4j.impl.StaticLoggerBinder. So I had > to also > > manually download and install the > > org/slf4j/slf4j-nop/1.4.2/slf4j-nop-1.4.2.jar in my local maven > > repository (see command below if anyone is interested) since I > couldn't > > figure out how to get it to grab it automatically from > www.slf4j.org <http://www.slf4j.org> > > <http://www.slf4j.org>'s site. I'm no maven expert, so there's > probably > > some better way to do it, I just don't know how yet. > > > > <dependency> > > <groupId>org.hibernate</groupId> > > <artifactId>hibernate-entitymanager</artifactId> > > <version>*3.4.0.GA <http://3.4.0.GA> <http://3.4.0.GA>*</version> > > <exclusions> > > <exclusion> > > <groupId>javax.transaction</groupId> > > <artifactId>jta</artifactId> > > </exclusion> > > </exclusions> > > </dependency> > > * <dependency> > > <groupId>org.slf4j</groupId> > > <artifactId>slf4j-nop</artifactId> > > <version>1.4.2</version> > > </dependency>* > > > > The maven command I ran to install slf4j-nop into my local > repository is: > > > > mvn deploy:deploy-file -DgroupId=org.slf4j -DartifactId=slf4j-nop > > -Dversion=1.4.2 -Dpackaging=jar -Dfile=c:/temp/slf4j-nop-1.4.2.jar > > -Durl=file://c:/temp > > > > Thanks again for your help, and I agree Derek that it would be > great to > > have this updated in the Archetype when you get a chance. > > > > Troy > > > > On Mon, Nov 2, 2009 at 11:55 AM, Derek Chen-Becker > > <dchenbec...@gmail.com <mailto:dchenbec...@gmail.com> > <mailto:dchenbec...@gmail.com <mailto:dchenbec...@gmail.com>>> wrote: > > > > If updating the pom hibernate version fixes the problem, > please file > > an issue and we'll update the Archetype. > > > > Thanks, > > > > Derek > > > > > > On Mon, Nov 2, 2009 at 6:23 AM, Chris Lewis > > <burningodzi...@gmail.com <mailto:burningodzi...@gmail.com> > <mailto:burningodzi...@gmail.com <mailto:burningodzi...@gmail.com>>> > wrote: > > > > > > 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 -~----------~----~----~----~------~----~------~--~---