[WARNING]
/private/var/www/wsbg/webapp/src/main/scala/com/foo/jpaweb/snippet/AuthorOps.scala:22:
error: value getName is not a member of com.foo.jpaweb.model.Author
[WARNING] "name" --> Text(author.getName()),
[WARNING] ^
[WARNING] one error found
I'm neither a Scala nor a Java programmer, but I'm guessing that the
getter for the name attribute in Scala is not "getName". Is this correct?
Chas.
Derek Chen-Becker wrote:
> Sorry I didn't get back to you on that. I'm working on an improved
> version of the tutorial to include a complete example but it's dependent
> on 0.10-SNAPSHOT right now. As soon as 0.10 goes GA I'll revise the
> tutorial page.
>
> Derek
>
> On Tue, Sep 2, 2008 at 8:35 PM, Charles F. Munat <ch...@munat.com
> <mailto:ch...@munat.com>> wrote:
>
>
> I figured it out, I think. Should be author.name
> <http://author.name>, without the parentheses.
Thanks for the help.
Chas.
I was planning to revise the tutorial myself, but since he has a revised
one pretty much ready to go (I think), I'm just trying to help him to
debug it.
Either way, it will be fixed shortly.
Chas.
Viktor Klang wrote:
> Sorry Chas,
>
> I think I expressed myself somewhat unfortunate,
> what I meant was: "Can you paste in the code for the Author-class"?
>
>
> Cheers,
> Viktor
>
> On Thu, Sep 4, 2008 at 10:18 PM, Charles F. Munat <ch...@munat.com
> <mailto:ch...@munat.com>> wrote:
>
>
> Oh, sorry, Victor. I think I posted a response to my own question almost
> immediately after I posted it. I was aiming this question at anyone who
> had used the JPA tutorial because I figured that the problem was in the
> difference between using POJOs and POSOs (hence, I assumed they would
> have not just the Author model, but the entire sample app, available). I
> should have tried a few things before posting. As it turned out, using
> author.name <http://author.name> worked fine.
>
> Thanks for the help.
>
> Chas.
>
> Viktor Klang wrote:
> > Chas,
> >
> > You'll have to give us more than that, i.e. the definition of Author.
> >
> > Cheers,
> > Viktor
> >
> > On Wed, Sep 3, 2008 at 4:29 AM, Charles F. Munat <ch...@munat.com
> <mailto:ch...@munat.com>
It would be usefull if you just posted the entity code - if it's from
the tutorial, or a varient of that, I don't see why your not giving
others their chance to contribute? Just post up the code... There are
a lot of talented people on this list who I'm sure can a) help improve
the implementation, and b) would be very interested to see scala JPA.
Cheers
Tim
Sent from my iPhone
mvn test
[17:12]
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[INFO] Building perscala
[INFO] task-segment: [test]
[INFO]
------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [scala:compile {execution: default}]
[INFO] suggestion: remove the scalaVersion from pom.xml
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [scala:testCompile {execution: default}]
[INFO] suggestion: remove the scalaVersion from pom.xml
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Surefire report directory:
/private/var/www/JPADemo/perscala/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.foo.jpaweb.model.TestJPAWeb
Sep 4, 2008 8:22:15 PM org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.3.0.GA
Sep 4, 2008 8:22:15 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.4
Sep 4, 2008 8:22:15 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Sep 4, 2008 8:22:15 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
Sep 4, 2008 8:22:15 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Sep 4, 2008 8:22:15 PM org.hibernate.ejb.Version <clinit>
INFO: Hibernate EntityManager 3.3.1.GA
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: com.foo.jpaweb.model.Book
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder bindQuery
INFO: Binding Named query: findBooksByAuthor => from Book b where
b.author.id = :id order by b.title
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder bindQuery
INFO: Binding Named query: findBooksByDate => from Book b where
b.published between :startDate and :endDate
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder bindQuery
INFO: Binding Named query: findBooksByTitle => from Book b where
lower(b.title) like :title order by b.title
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder bindQuery
INFO: Binding Named query: findAllBooks => from Book b order by b.title
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity com.foo.jpaweb.model.Book on table Book
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: com.foo.jpaweb.model.Author
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder bindQuery
INFO: Binding Named query: findAllAuthors => from Author a order by a.name
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity com.foo.jpaweb.model.Author on table Author
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.CollectionBinder
bindOneToManySecondPass
INFO: Mapping collection: com.foo.jpaweb.model.Author.books -> Book
Sep 4, 2008 8:22:16 PM org.hibernate.validator.Version <clinit>
INFO: Hibernate Validator 3.0.0.GA
Sep 4, 2008 8:22:16 PM
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Sep 4, 2008 8:22:16 PM
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Sep 4, 2008 8:22:16 PM
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: true
Sep 4, 2008 8:22:16 PM
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:file:jpaweb
Sep 4, 2008 8:22:16 PM
org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=sa, password=****, autocommit=true,
release_mode=auto}
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: HSQL Database Engine, version: 1.8.0
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: HSQL Database Engine Driver, version: 1.8.0
Sep 4, 2008 8:22:16 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.HSQLDialect
Sep 4, 2008 8:22:16 PM
org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
Sep 4, 2008 8:22:16 PM
org.hibernate.transaction.TransactionManagerLookupFactory
getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of
read-write or transactional second-level cache is not recommended)
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): disabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 3
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory
createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Sep 4, 2008 8:22:16 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory
<init>
INFO: Using ASTQueryTranslatorFactory
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: enabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Echoing all SQL to stdout
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Sep 4, 2008 8:22:16 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
Sep 4, 2008 8:22:16 PM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Sep 4, 2008 8:22:17 PM org.hibernate.impl.SessionFactoryObjectFactory
addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
Sep 4, 2008 8:22:17 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: Running hbm2ddl schema update
Sep 4, 2008 8:22:17 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: fetching database metadata
Sep 4, 2008 8:22:17 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: updating schema
Sep 4, 2008 8:22:17 PM org.hibernate.tool.hbm2ddl.DatabaseMetadata
getTableMetadata
INFO: table not found: Author
Sep 4, 2008 8:22:17 PM org.hibernate.tool.hbm2ddl.DatabaseMetadata
getTableMetadata
INFO: table not found: Book
Sep 4, 2008 8:22:17 PM org.hibernate.tool.hbm2ddl.DatabaseMetadata
getTableMetadata
INFO: table not found: Author
Sep 4, 2008 8:22:17 PM org.hibernate.tool.hbm2ddl.DatabaseMetadata
getTableMetadata
INFO: table not found: Book
Sep 4, 2008 8:22:17 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: schema update complete
Sep 4, 2008 8:22:17 PM org.hibernate.impl.SessionFactoryImpl close
INFO: closing
Sep 4, 2008 8:22:17 PM
org.hibernate.connection.DriverManagerConnectionProvider close
INFO: cleaning up connection pool: jdbc:hsqldb:file:jpaweb
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.095
sec <<< FAILURE!
Results :
Tests in error:
save_stuff(com.foo.jpaweb.model.TestJPAWeb)
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] There are test failures.
Please refer to
/private/var/www/JPADemo/perscala/target/surefire-reports for the
individual test results.
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 7 seconds
[INFO] Finished at: Thu Sep 04 20:22:17 PDT 2008
[INFO] Final Memory: 9M/17M
[INFO]
------------------------------------------------------------------------
This was after making the following change to perscala/pom.xml suggested
by Derek:
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>ejb</artifactId>
<version>3.0</version>
</dependency>
to
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
</dependency>
Here is what is in my perscala/src/main/resources folder. The same jars
are in the webapp/src/main/resources folder.
ejb3-persistence.jar
hibernate-testing.jar*
jta.jar
slf4j-jcl-1.5.2.jar
antlr-2.7.6.jar
hibernate-annotations.jar
hibernate3.jar*
lift_chef.properties
commons-collections-3.1.jar
hibernate-commons-annotations.jar
javassist-3.4.GA.jar
slf4j-api-1.4.2.jar
dom4j-1.6.1.jar
hibernate-core.jar
javassist.jar
slf4j-api-1.5.2.jar
dom4j.jar
hibernate-entitymanager.jar
jta-1.1.jar
slf4j-api.jar
Obviously, I don't need all of these, but I haven't figured out which
ones go where yet.
The remaining code is identical to what Derek just posted.
Any ideas?
Chas.
Derek Chen-Becker wrote:
> I agree with keeping the discussions on-list. I've actually been asking
> the relevant questions on-list, just not in the thread of the final JPA
> demo project. I didn't intend to be seen as hiding it, I just didn't
> want to post up code and a tutorial that were based on a SNAPSHOT
> version. In hindsight maybe that wasn't appropriate and I apologize if
> that came off negatively; I really enjoy being part of such a vibrant
> project/community and I'm hoping this work helps others using JPA get
> their feet wet with Lift :)
>
> Cheers,
>
> Derek
>
> On Fri, Sep 5, 2008 at 7:41 AM, David Pollak
> <feeder.of...@gmail.com <mailto:feeder.of...@gmail.com>>
> 1. The webapp module is dependent on the perscala module. As
> the project is currently layed out, you need to run "mvn
> install" in the perscala project before you can go into
> the webapp project and run "mvn jetty:run". I was hoping
> there would be a way for the webapp module to trigger the
> "mvn install" when you try to run things (test, jetty:run,
> etc), but I'm no maven guru
> 2. I had some problems with my dependencies that meant you
> had to manually install some jars. I'm hoping to get it
> down to completely automatic on the dependency updates.
>
> Cheers
>
> Derek
>
>
> On Fri, Sep 5, 2008 at 5:26 AM, Tim Perrett
> <he...@timperrett.com <mailto:he...@timperrett.com>> wrote:
>
>
> Chas,
>
> It would be usefull if you just posted the entity code - if
> it's from
> the tutorial, or a varient of that, I don't see why your not
> giving
> others their chance to contribute? Just post up the code...
> There are
> a lot of talented people on this list who I'm sure can a)
> help improve
> the implementation, and b) would be very interested to see
> scala JPA.
>
> Cheers
>
> Tim
>
> Sent from my iPhone
>
> On 5 Sep 2008, at 10:20, "Charles F. Munat" <ch...@munat.com
> >> <mailto:ch...@munat.com <mailto:ch...@munat.com>>> wrote:
> >>
> >>
> >> Oh, sorry, Victor. I think I posted a response to my own
> >> question almost
> >> immediately after I posted it. I was aiming this
> question at
> >> anyone who
> >> had used the JPA tutorial because I figured that the
> problem was
> >> in the
> >> difference between using POJOs and POSOs (hence, I
> assumed they
> >> would
> >> have not just the Author model, but the entire sample
> app,
> >> available). I
> >> should have tried a few things before posting. As it
> turned out,
> >> using
> >> author.name <http://author.name> <http://author.name>
The exception was this code, which is directly from the JPA tutorial on
the wiki:
def list (xhtml : NodeSeq) : NodeSeq = {
val authors = Model.em.createQuery("from
Author").getResultList().asInstanceOf[java.util.List[Author]]
authors.flatMap(author =>
bind("auth", xhtml,
"name" --> Text(author.getName()),
"count" --> Text(author.getBooks().size().toString)))
}
This was written for the POJO version of the code. But when I tried
substituting the Scala objects (for Author and Book) later in the
tutorial, this code broke on author.getName(). I am not a Java
programmer, but I assumed that this was a difference between the getters
of Java and Scala. I tried author.name instead and that seemed to work.
I posted the change back to the list.
As for changing the tutorial on the wiki, I would not change another's
work without first asking him. So I contacted Derek with an offer either
to provide a list of changes to his tutorial -- most of them having to
do with clarity for newbies like me -- or to make the changes myself,
and he told me that he had a new one in the bag and was only waiting for
0.10 to post it. I was very happy I had not wasted a lot of time
changing a tutorial which will be shortly obsolete.
He also sent me the completed code for the the new tutorial. I looked at
the code for the new tutorial and the above issue was resolved (and
differently from the way I had done it).
I'm assuming that Derek will make the changes shortly. Maybe he can be
persuaded to do so before 0.10, since it seems that version is still a
ways off and others might want to use the tutorial in the meantime.
As for our conversation off the list, it only involved a couple of
questions from me about how to get his new code to run on my machine,
and would have been difficult to explain without posting all the code.
That, IMO, was Derek's prerogative, not mine. Now he has now posted it I
am more than happy to direct questions to the list.
I hope this clears up any misunderstandings.
Chas.
I removed them all, but still get the exact same error on mvn test.
Chas.
> INFO: Hibernate Annotations 3.3.0.GA <http://3.3.0.GA>
> Sep 4, 2008 8:22:15 PM org.hibernate.cfg.Environment <clinit>
> INFO: Hibernate 3.2.4
> Sep 4, 2008 8:22:15 PM org.hibernate.cfg.Environment <clinit>
> INFO: hibernate.properties not found
> Sep 4, 2008 8:22:15 PM org.hibernate.cfg.Environment
> buildBytecodeProvider
> INFO: Bytecode provider name : cglib
> Sep 4, 2008 8:22:15 PM org.hibernate.cfg.Environment <clinit>
> INFO: using JDK 1.4 java.sql.Timestamp handling
> Sep 4, 2008 8:22:15 PM org.hibernate.ejb.Version <clinit>
> INFO: Hibernate EntityManager 3.3.1.GA <http://3.3.1.GA>
> Sep 4, 2008 8:22:16 PM org.hibernate.cfg.AnnotationBinder bindClass
> INFO: Binding entity from annotated class: com.foo.jpaweb.model.Book
> Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder
> bindQuery
> INFO: Binding Named query: findBooksByAuthor => from Book b where
> b.author.id <http://b.author.id> = :id order by b.title
> Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder
> bindQuery
> INFO: Binding Named query: findBooksByDate => from Book b where
> b.published between :startDate and :endDate
> Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder
> bindQuery
> INFO: Binding Named query: findBooksByTitle => from Book b where
> lower(b.title) like :title order by b.title
> Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder
> bindQuery
> INFO: Binding Named query: findAllBooks => from Book b order by b.title
> Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.EntityBinder
> bindTable
> INFO: Bind entity com.foo.jpaweb.model.Book on table Book
> Sep 4, 2008 8:22:16 PM org.hibernate.cfg.AnnotationBinder bindClass
> INFO: Binding entity from annotated class: com.foo.jpaweb.model.Author
> Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder
> bindQuery
> INFO: Binding Named query: findAllAuthors => from Author a order by
> a.name <http://a.name>
> Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.EntityBinder
> bindTable
> INFO: Bind entity com.foo.jpaweb.model.Author on table Author
> Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.CollectionBinder
> bindOneToManySecondPass
> INFO: Mapping collection: com.foo.jpaweb.model.Author.books -> Book
> Sep 4, 2008 8:22:16 PM org.hibernate.validator.Version <clinit>
> INFO: Hibernate Validator 3.0.0.GA <http://3.0.0.GA>
> <mailto:feeder.of...@gmail.com
> <mailto:feeder.of...@gmail.com>>>
> > wrote:
> >
> > Derek,
> >
> > Thanks for posting up the code.
> >
> > In general, I like to keep conversations on-list. People learn a
> > lot by seeing back and forth communications rather than
> simply the
> > magic result. Additionally, there are a number of folks who have
> > different skills and different perspectives and allowing them
> to be
> > part of the conversation is very important as well... as they
> will
> > contribute to the over-all result.
> >
> > To put this in perspective, I have very, very few off-list
> > communications (and they are mainly in the form of IMs related to
> > small, timely decisions) with the other committers about what we
> > commit to Lift. We intensionally keep our communications
> visible.
> >
> > Thanks,
> >
> > David
> >
> >
> > On Fri, Sep 5, 2008 at 6:01 AM, Derek Chen-Becker
> > <dchen...@gmail.com <mailto:dchen...@gmail.com>
> <mailto:he...@timperrett.com <mailto:he...@timperrett.com>>> wrote:
> >
> >
> > Chas,
> >
> > It would be usefull if you just posted the entity
> code - if
> > it's from
> > the tutorial, or a varient of that, I don't see why
> your not
> > giving
> > others their chance to contribute? Just post up the
> code...
> > There are
> > a lot of talented people on this list who I'm sure can a)
> > help improve
> > the implementation, and b) would be very interested
> to see
> > scala JPA.
> >
> > Cheers
> >
> > Tim
> >
> > Sent from my iPhone
> >
> > On 5 Sep 2008, at 10:20, "Charles F. Munat"
> <ch...@munat.com <mailto:ch...@munat.com>
-------------------------------------------------------------------------------
Test set: com.foo.jpaweb.model.TestJPAWeb
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.577
sec <<< FAILURE!
save_stuff(com.foo.jpaweb.model.TestJPAWeb) Time elapsed: 2.531 sec
<<< ERROR!
java.lang.NoClassDefFoundError: javax/transaction/SystemException
at
org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:37)
at
org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:32)
at com.foo.jpaweb.model.TestJPAWeb.save_stuff(Test.scala:25)
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.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at
org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at
org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
Chas.
> > b.author.id <http://b.author.id> <http://b.author.id> = :id
> order by b.title
> > Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder
> > bindQuery
> > INFO: Binding Named query: findBooksByDate => from Book b where
> > b.published between :startDate and :endDate
> > Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder
> > bindQuery
> > INFO: Binding Named query: findBooksByTitle => from Book b where
> > lower(b.title) like :title order by b.title
> > Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder
> > bindQuery
> > INFO: Binding Named query: findAllBooks => from Book b order
> by b.title
> > Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.EntityBinder
> > bindTable
> > INFO: Bind entity com.foo.jpaweb.model.Book on table Book
> > Sep 4, 2008 8:22:16 PM org.hibernate.cfg.AnnotationBinder
> bindClass
> > INFO: Binding entity from annotated class:
> com.foo.jpaweb.model.Author
> > Sep 4, 2008 8:22:16 PM org.hibernate.cfg.annotations.QueryBinder
> > bindQuery
> > INFO: Binding Named query: findAllAuthors => from Author a
> order by
> > a.name <http://a.name> <http://a.name>
Well, the only thing it helps is my ego, which I guess is the problem ;)
mvn jetty:run -U
[14:57]
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'jetty'.
[INFO] org.apache.maven.plugins: checking for updates from scala-tools.org
[INFO] org.apache.maven.plugins: checking for updates from central
[INFO] org.codehaus.mojo: checking for updates from scala-tools.org
[INFO] org.codehaus.mojo: checking for updates from central
[INFO] artifact org.scala-tools:maven-scala-plugin: checking for updates
from scala-tools.org
[INFO] artifact org.scala-tools:maven-scala-plugin: checking for updates
from central
[INFO] artifact org.apache.maven.plugins:maven-eclipse-plugin: checking
for updates from scala-tools.org
[INFO] artifact org.apache.maven.plugins:maven-eclipse-plugin: checking
for updates from central
[INFO] artifact org.mortbay.jetty:maven-jetty-plugin: checking for
updates from scala-tools.org
[INFO] artifact org.mortbay.jetty:maven-jetty-plugin: checking for
updates from central
[INFO] artifact net.sf.alchim:yuicompressor-maven-plugin: checking for
updates from scala-tools.org
[INFO] artifact net.sf.alchim:yuicompressor-maven-plugin: checking for
updates from central
[INFO]
------------------------------------------------------------------------
[INFO] Building webapp
[INFO] task-segment: [jetty:run]
[INFO]
------------------------------------------------------------------------
[INFO] Preparing jetty:run
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
Downloading:
http://scala-tools.org/repo-releases/rhino/js/1.6R7/js-1.6R7.pom
Downloading:
http://wicketstuff.org/maven/repository//rhino/js/1.6R7/js-1.6R7.pom
Downloading: http://repo1.maven.org/maven2/rhino/js/1.6R7/js-1.6R7.pom
786b downloaded
Downloading:
http://scala-tools.org/repo-releases/net/sf/retrotranslator/retrotranslator-runtime/1.2.1/retrotranslator-runtime-1.2.1.pom
Downloading:
http://wicketstuff.org/maven/repository//net/sf/retrotranslator/retrotranslator-runtime/1.2.1/retrotranslator-runtime-1.2.1.pom
Downloading:
http://repo1.maven.org/maven2/net/sf/retrotranslator/retrotranslator-runtime/1.2.1/retrotranslator-runtime-1.2.1.pom
1K downloaded
Downloading:
http://scala-tools.org/repo-releases/backport-util-concurrent/backport-util-concurrent/3.0/backport-util-concurrent-3.0.pom
Downloading:
http://wicketstuff.org/maven/repository//backport-util-concurrent/backport-util-concurrent/3.0/backport-util-concurrent-3.0.pom
Downloading:
http://repo1.maven.org/maven2/backport-util-concurrent/backport-util-concurrent/3.0/backport-util-concurrent-3.0.pom
909b downloaded
Downloading:
http://scala-tools.org/repo-releases/rhino/js/1.6R7/js-1.6R7.jar
Downloading:
http://wicketstuff.org/maven/repository//rhino/js/1.6R7/js-1.6R7.jar
Downloading: http://repo1.maven.org/maven2/rhino/js/1.6R7/js-1.6R7.jar
794K downloaded
Downloading:
http://scala-tools.org/repo-releases/net/sf/retrotranslator/retrotranslator-runtime/1.2.1/retrotranslator-runtime-1.2.1.jar
Downloading:
http://wicketstuff.org/maven/repository//net/sf/retrotranslator/retrotranslator-runtime/1.2.1/retrotranslator-runtime-1.2.1.jar
Downloading:
http://repo1.maven.org/maven2/net/sf/retrotranslator/retrotranslator-runtime/1.2.1/retrotranslator-runtime-1.2.1.jar
245K downloaded
Downloading:
http://scala-tools.org/repo-releases/backport-util-concurrent/backport-util-concurrent/3.0/backport-util-concurrent-3.0.jar
Downloading:
http://wicketstuff.org/maven/repository//backport-util-concurrent/backport-util-concurrent/3.0/backport-util-concurrent-3.0.jar
Downloading:
http://scala-tools.org/repo-releases/backport-util-concurrent/backport-util-concurrent/3.0/backport-util-concurrent-3.0.jar
Downloading:
http://repo1.maven.org/maven2/backport-util-concurrent/backport-util-concurrent/3.0/backport-util-concurrent-3.0.jar
320K downloaded
[INFO] [yuicompressor:compress {execution: default}]
[INFO] datePicker.css (2283b) -> datePicker.css (1658b)[72%]
[WARNING] .../src/main/webapp/scripts/date.js:line -1:column -1:Try to
use a single 'var' statement per scope.
){var f=Date.format; ---> var <--- d=new Date("01/01/1977");var iY
[WARNING] .../src/main/webapp/scripts/date.js:line -1:column -1:Try to
use a single 'var' statement per scope.
var d=new Date("01/01/1977"); ---> var <--- iY=f.indexOf("yyyy");if
[WARNING] .../src/main/webapp/scripts/date.js:line -1:column -1:Try to
use a single 'var' statement per scope.
"yy"),2)));} ---> var <--- iM=f.indexOf("mmm");if
[WARNING] .../src/main/webapp/scripts/date.js:line -1:column -1:Try to
use a single 'var' statement per scope.
;if(iM>-1){ ---> var <--- mStr=s.substr(iM,3)
[WARNING] .../src/main/webapp/scripts/date.js:line -1:column -1:Try to
use a single 'var' statement per scope.
substr(iM,3);for( ---> var <--- i=0;i<Date.abbrMonthNames.
[INFO] date.js (11520b) -> date.js (2888b)[25%]
[INFO] jquery.bgiframe.js (4825b) -> jquery.bgiframe.js (1028b)[21%]
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
showHeader!=$.dpConst.SHOW_HEADER_NONE){ ---> var <--- headRow=$(dc("tr"));
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
(dc("tr"));for( ---> var <--- i=Date.firstDayOfWeek;i<Date.
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
.firstDayOfWeek+7;i++){ ---> var <--- weekday=i%7;var day=Date
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
){var weekday=i%7; ---> var <--- day=Date.dayNames[weekday];headRow
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
1):day));}} ---> var <--- calendarTable=$(dc("table")).
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
):dc("thead"))); ---> var <--- tbody=$(dc("tbody"));
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
=$(dc("tbody")); ---> var <--- today=(new Date()).zeroTime
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
Date()).zeroTime(); ---> var <--- month=s.month==undefined?today.
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
.getMonth():s.month; ---> var <--- year=s.year||today.getFullYear(
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
.year||today.getFullYear(); ---> var <--- currentDate=new Date(year,month,1
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
Date(year,month,1); ---> var <---
firstDayOffset=Date.firstDayOfWeek-currentDate.getDay(
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
>1){firstDayOffset-=7;} ---> var <--- weeksToDraw=Math.ceil(((-1
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
currentDate.addDays(firstDayOffset-1); ---> var <--- doHover=function
(){if(s.
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
(s.hoverClass);}}; ---> var <--- unHover=function (){if(s.
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
(s.hoverClass);}}; ---> var <--- w=0;while(w++<weeksToDraw
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
;while(w++<weeksToDraw){ ---> var <--- r=jQuery(dc("tr"));
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
(dc("tr"));for( ---> var <--- i=0;i<7;i++
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:The variable i has already been declared in the same scope...
dc("tr"));for(var ---> i <--- =0;i<7;i++)
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
;i<7;i++){ ---> var <--- thisMonth=currentDate.getMonth()==month;
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
=currentDate.getMonth()==month; ---> var <--- d=$(dc("td")).
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
{var $this=$(this); ---> var <--- alreadyExists=true;if(!this._dpId
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
false;$this.empty();} ---> var <--- controller=$.event._dpCache[this.
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
.dpDisplay();});} ---> var <--- d=Date.fromString(this.value)
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
);s.setDate(1); ---> var <--- e=new Date(this.endDate.getTime
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
);e.setDate(1); ---> var <--- t;if((!m&&!y
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
this.ele;var c=this; ---> var <--- $ele=$(eleAlignTo);var eleOffset=
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
;var $ele=$(eleAlignTo); ---> var <--- eleOffset=$ele.offset();var
$createIn
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
var eleOffset=$ele.offset(); ---> var <--- $createIn;var attrs;var
attrsCalendarHolder;var cssRules
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
$ele.offset();var $createIn; ---> var <--- attrs;var
attrsCalendarHolder;var cssRules;if(
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
();var $createIn;var attrs; ---> var <--- attrsCalendarHolder;var
cssRules;if(c.inline
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
var $createIn;var attrs;var attrsCalendarHolder; ---> var <---
cssRules;if(c.inline){$createIn
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
eleOffset.left+c.horizontalOffset}; ---> var <--- _checkMouse=function
(e){var el=
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
){var el=e.target; ---> var <--- cal=$("#dp-popup")[0];
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
"dp-calendar")).bgIframe()); ---> var <--- $pop=this.inline?$(".dp-popup",
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
){var c=this.dpController; ---> var <--- d=new Date(thisDate.getTime()
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
".selected")||!c.selectMultiple); ---> var <--- s=c.isSelected(d);$
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
.addClass("selected");}for( ---> var <--- i=0;i<c.renderCallback.
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
.context).removeClass("disabled"); ---> var <---
d=this.startDate.getDate();
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:The variable d has already been declared in the same scope...
context).removeClass("disabled");var ---> d <---
=this.startDate.getDate();if
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
);if(d>20){ ---> var <--- sd=new Date(this.startDate.getTime
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
addClass("disabled");}}); ---> var <--- d=this.endDate.getDate();
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:The variable d has already been declared in the same scope...
("disabled");}});var ---> d <--- =this.endDate.getDate();$
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
.context).removeClass("disabled"); ---> var <--- d=this.endDate.getDate();
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:The variable d has already been declared in the same scope...
context).removeClass("disabled");var ---> d <--- =this.endDate.getDate();if
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
);if(d<13){ ---> var <--- ed=new Date(this.endDate.getTime
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Try to use a single 'var' statement per scope.
event._dpCache||[];for( ---> var <--- i in els){$(els[i
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Found an undeclared symbol: $e
},setDisabled:function (s){ ---> $e <--- =$(this.ele);$e[
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:Found an undeclared symbol: s
{var r=[];for( ---> s <--- in this.selectedDates){if(this.
[WARNING] .../src/main/webapp/scripts/jquery.datePicker.js:line
-1:column -1:The symbol attrsCalendarHolder is declared but is
apparently never used.
This code can probably be written in a more compact way.
);var $createIn;var attrs;var ---> attrsCalendarHolder <--- ;var
cssRules;if(c.inline)
[INFO] jquery.datePicker.js (37645b) -> jquery.datePicker.js (13021b)[34%]
[INFO] total input (56273b) -> output (18595b)[33%]
[INFO] nb warnings: 54, nb errors: 0
[INFO] snapshot net.liftweb:lift-webkit:0.10-SNAPSHOT: checking for
updates from scala-tools.org
Downloading:
http://scala-tools.org/repo-releases/net/liftweb/lift-webkit/0.10-SNAPSHOT/lift-webkit-0.10-SNAPSHOT.pom
Downloading:
http://scala-tools.org/repo-releases/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom
Downloading:
http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom
157b downloaded
[INFO] artifact org.mortbay.jetty:jetty: checking for updates from
scala-tools.org
[INFO] artifact org.mortbay.jetty:jetty: checking for updates from central
Downloading:
http://scala-tools.org/repo-releases/org/mortbay/jetty/jetty/6.1.11/jetty-6.1.11.pom
Downloading:
http://repo1.maven.org/maven2/org/mortbay/jetty/jetty/6.1.11/jetty-6.1.11.pom
4K downloaded
Downloading:
http://scala-tools.org/repo-releases/org/mortbay/jetty/project/6.1.11/project-6.1.11.pom
Downloading:
http://repo1.maven.org/maven2/org/mortbay/jetty/project/6.1.11/project-6.1.11.pom
12K downloaded
Downloading:
http://scala-tools.org/repo-releases/org/mortbay/jetty/jetty-util/6.1.11/jetty-util-6.1.11.pom
Downloading:
http://repo1.maven.org/maven2/org/mortbay/jetty/jetty-util/6.1.11/jetty-util-6.1.11.pom
3K downloaded
Downloading:
http://scala-tools.org/repo-releases/org/mortbay/jetty/servlet-api-2.5/6.1.11/servlet-api-2.5-6.1.11.pom
Downloading:
http://repo1.maven.org/maven2/org/mortbay/jetty/servlet-api-2.5/6.1.11/servlet-api-2.5-6.1.11.pom
3K downloaded
[INFO] snapshot com.foo.jpaweb:perscala:1.0-SNAPSHOT: checking for
updates from scala-tools.org
Downloading:
http://scala-tools.org/repo-releases/com/foo/jpaweb/perscala/1.0-SNAPSHOT/perscala-1.0-SNAPSHOT.pom
Downloading:
http://scala-tools.org/repo-releases/net/liftweb/lift-webkit/0.10-SNAPSHOT/lift-webkit-0.10-SNAPSHOT.jar
Downloading:
http://scala-tools.org/repo-releases/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar
Downloading:
http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar
102K downloaded
Downloading:
http://scala-tools.org/repo-releases/com/foo/jpaweb/perscala/1.0-SNAPSHOT/perscala-1.0-SNAPSHOT.jar
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) net.liftweb:lift-webkit:jar:0.10-SNAPSHOT
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=net.liftweb
-DartifactId=lift-webkit -Dversion=0.10-SNAPSHOT -Dpackaging=jar
-Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the
file there:
mvn deploy:deploy-file -DgroupId=net.liftweb
-DartifactId=lift-webkit -Dversion=0.10-SNAPSHOT -Dpackaging=jar
-Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) com.foo.jpaweb:webapp:war:1.0-SNAPSHOT
2) net.liftweb:lift-webkit:jar:0.10-SNAPSHOT
2) com.foo.jpaweb:perscala:jar:1.0-SNAPSHOT
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.foo.jpaweb
-DartifactId=perscala -Dversion=1.0-SNAPSHOT -Dpackaging=jar
-Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the
file there:
mvn deploy:deploy-file -DgroupId=com.foo.jpaweb
-DartifactId=perscala -Dversion=1.0-SNAPSHOT -Dpackaging=jar
-Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) com.foo.jpaweb:webapp:war:1.0-SNAPSHOT
2) com.foo.jpaweb:perscala:jar:1.0-SNAPSHOT
----------
2 required artifacts are missing.
for artifact:
com.foo.jpaweb:webapp:war:1.0-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
scala-tools.org (http://scala-tools.org/repo-releases)
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 22 seconds
[INFO] Finished at: Fri Sep 05 14:58:27 PDT 2008
[INFO] Final Memory: 16M/30M
[INFO]
------------------------------------------------------------------------
Am I missing something?
Chas.
Derek Chen-Becker wrote:
> OK, to test this out, I completely erased my local maven repository. I
> then did a "mvn clean" on the top-level jpademo project, then went into
> the perscala module and ran a "mvn test" there. That fails on finding
> the JTA jar:
>
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Failed to resolve artifact.
>
> Missing:
> ----------
> 1) javax.transaction:jta:jar:1.0.1B
>
> Try downloading the file manually from:
> http://java.sun.com/products/jta
>
> Then, install it using the command:
> mvn install:install-file -DgroupId=javax.transaction
> -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=/path/to/file
>
>
> So I went to the website listed, downloaded the zip file there,
> converted the zip file into a jar (unzip jta-1_0_1B-classes.zip
> > > a.name <http://a.name> <http://a.name> <http://a.name>
OK, did that, and mvn test ran successfully.
Am I missing something?
mvn -v
Maven version: 2.0.9
Java version: 1.5.0_13
OS name: "mac os x" version: "10.5.4" arch: "i386" Family: "unix"
I confirmed that the jar exists and contains SystemException:
408 Thu Oct 31 14:21:24 PST 2002 javax/transaction/SystemException.class
???
Chas.
THANK YOU VERY MUCH, DEREK.
Now, any ideas on how to switch it from HSQLDB to PostgreSQL?
I presume that I should change:
perscala/pom.xml:
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.7</version>
</dependency>
to
<dependency>
<groupId>org.postgresql.Driver</groupId>
<artifactId>postgres</artifactId>
<version>8.3</version>
</dependency>
And change webapp/pom.xml:
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.2.2.0</version>
</dependency>
to
<dependency>
<groupId> org.postgresql.Driver</groupId>
<artifactId>postgres</artifactId>
<version>8.3</version>
</dependency>
Or do I even need this, as the Derby code is commented out and all
access to the DB will be through perscala?
And change perscala/resources/META-INF/persistence.xml:
<property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.connection.driver_class"
value="org.hsqldb.jdbcDriver"/>
to
<property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.connection.driver_class"
value="org.postgresql.jdbcDriver"/>
I'm not quite sure what to do about the jpaweb.properties file:
#HSQL Database Engine 1.8.0.5
#Fri Sep 05 15:02:33 PDT 2008
hsqldb.script_format=0
runtime.gc_interval=0
sql.enforce_strict_size=false
hsqldb.cache_size_scale=8
readonly=false
hsqldb.nio_data_file=true
hsqldb.cache_scale=14
version=1.8.0
hsqldb.default_table_type=memory
hsqldb.cache_file_scale=1
hsqldb.log_size=200
modified=yes
hsqldb.cache_version=1.7.0
hsqldb.original_version=1.8.0
hsqldb.compatible_version=1.8.0
Do I need this?
Chas.
<property name="hibernate.connection.url"
value="jdbc:hsqldb:file:jpaweb"/>
Chas.
Switching to PostgreSQL was quite simple:
1. in perscala/pom.xml, replace this:
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.7</version>
</dependency>
with this:
<dependency>
<groupId>org.postgresql.Driver</groupId>
<artifactId>postgres</artifactId>
<version>8.3</version>
</dependency>
No need to change anything in webapp/pom.xml.
Change perscala/resources/META-INF/persistence.xml from this:
<persistence>
<persistence-unit name="jpaweb" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.connection.driver_class"
value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.connection.url"
value="jdbc:hsqldb:file:jpaweb"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>
to this:
<persistence>
<persistence-unit name="jpaweb" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.connection.driver_class"
value="org.postgresql.Driver"/>
<property name="hibernate.connection.username" value="[psql user]"/>
<property name="hibernate.connection.password" value="[psql
password]"/>
<property name="hibernate.connection.url"
value="jdbc:postgresql://localhost/jpaweb"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>
You'll need to replace [psql user] and [psql password] in the above code
with the appropriate username and password respectively for your
PostgreSQL installation.
Create a new database in PostgreSQL called jpaweb (UTF-8). Then cd to
the perscala directory and run mvn install to add the changes. Go back
to the webapp directory and run mvn jetty:run -U. Then check your
PostgreSQL server and you should find that the book and author tables
have appeared in your jpaweb database.
Cool. This is the most progress I've made (and the fastest) since I
started looking at Lift months ago. Thanks again Derek. I owe you at
least a beer.
Chas.
<repositories>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
</repositories>
Make sure it also has repo-snapshots, like so:
<repositories>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-snapshots</url>
</repository>
</repositories>
--j
Derek Chen-Becker wrote:
> Rock on! Glad to hear it's working for you now :). In the
> persistence.xml the line
>
> <property name="hibernate.hbm2ddl.auto" value="update" />
>
> Is what should make automatically populate the DB with tables, etc. As
> an added bonus, if you change the def of an object, it should update the
> tables, although I caution against doing this in a production
> environment with real data. For production I usually copy the schema
> from my dev version and remove that line so I don't get nasty surprises.
> Also, for production you can set the value of
>
> <property name="hibernate.show_sql" value="true" />
>
> to false to turn off the debug SQL printing (unless you really want it).
>
> Derek
>
> On Fri, Sep 5, 2008 at 5:17 PM, Charles F. Munat <ch...@munat.com
> <mailto:ch...@munat.com>> wrote:
>
>
> Answering my own posts...
>
> Switching to PostgreSQL was quite simple:
>
> 1. in perscala/pom.xml, replace this:
>
> <dependency>
> <groupId>hsqldb</groupId>
> <artifactId>hsqldb</artifactId>
> <version>1.8.0.7 <http://1.8.0.7></version>
> > <version>1.8.0.7 <http://1.8.0.7></version>
> > </dependency>
> >
> > to
> >
> > <dependency>
> > <groupId>org.postgresql.Driver</groupId>
> > <artifactId>postgres</artifactId>
> > <version>8.3</version>
> > </dependency>
> >
> > And change webapp/pom.xml:
> >
> > <dependency>
> > <groupId>org.apache.derby</groupId>
> > <artifactId>derby</artifactId>
> > <version>10.2.2.0 <http://10.2.2.0></version>
> > </dependency>
> >
> > to
> >
> > <dependency>
> > <groupId> org.postgresql.Driver</groupId>
> > <artifactId>postgres</artifactId>
> > <version>8.3</version>
> > </dependency>
> >
> > Or do I even need this, as the Derby code is commented out and all
> > access to the DB will be through perscala?
> >
> > And change perscala/resources/META-INF/persistence.xml:
> >
> > <property name="hibernate.dialect"
> > value="org.hibernate.dialect.HSQLDialect"/>
> > <property name="hibernate.connection.driver_class"
> > value="org.hsqldb.jdbcDriver"/>
> >
> > to
> >
> > <property name="hibernate.dialect"
> > value="org.hibernate.dialect.PostgreSQLDialect"/>
> > <property name="hibernate.connection.driver_class"
> > value="org.postgresql.jdbcDriver"/>
> >
> > I'm not quite sure what to do about the jpaweb.properties file:
> >
> > #HSQL Database Engine 1.8.0.5 <http://1.8.0.5>
> > #Fri Sep 05 15:02:33 PDT 2008
> > hsqldb.script_format=0
> > runtime.gc_interval=0
> > sql.enforce_strict_size=false
> > hsqldb.cache_size_scale=8
> > readonly=false
> > hsqldb.nio_data_file=true
> > hsqldb.cache_scale=14
> > version=1.8.0
> > hsqldb.default_table_type=memory
> > hsqldb.cache_file_scale=1
> > hsqldb.log_size=200
> > modified=yes
> > hsqldb.cache_version=1.7.0
> > hsqldb.original_version=1.8.0
> > hsqldb.compatible_version=1.8.0
> >
> > Do I need this?
> >
> > Chas.
> >
> > Derek Chen-Becker wrote:
> >>
> >> On Fri, Sep 5, 2008 at 4:01 PM, Charles F. Munat <ch...@munat.com
> <mailto:ch...@munat.com>
...
[Message clipped]
...
[Message clipped]
...
[Message clipped]
And down the road, when the mapper becomes agnostic, would there be an
archetype that used JPA as the back end for the Lift mapper?
Chas.
Oliver
On 08/09/2008, at 9:52 AM, Charles F. Munat wrote:
>
> Oh, hell yeah. Please!
>
> And down the road, when the mapper becomes agnostic, would there be an
> archetype that used JPA as the back end for the Lift mapper?
>
> Chas.
>
> Tim Perrett wrote:
>> Ah cool - this is quite nice actually; good work Oliver!
Cheers
On Mon, Sep 8, 2008 at 12:29 PM, Tim Perrett wrote:
>
> Just been doing some more debugging on this - it appears that the
> correct values are being passed through and are assigned to an entity
> instance, but they blow up when trying to do the em.merge(author)
> call.
>
> The stack trace I get is:
You didn't post the full stack trace (or at least, it didn't show up
in gmail), but there are only two places I can see merge being called:
(Authors)
def add (xhtml : NodeSeq) : NodeSeq = {
def doAdd () = {
if (author.name.length == 0) {
error("emptyAuthor", "The author's name cannot be blank")
} else {
Model.merge(author)
redirectTo("list.html")
}
}
and (Books) ....
def add (xhtml : NodeSeq) : NodeSeq = {
def doAdd () = {
Model.merge(book)
redirectTo("list.html")
}
The above looks slightly fishy, but I'm afraid I don't have time right
now to try the project to check.
If you want to add something, shouldn't you be calling persist rather
than merge?
I'd expect to see merge being used in a method called doUpdate() or whatever...
... or can you really get away with calling merge when something's not
in the DB yet?
Just a thought.
Regards
Martin
>
> I agree - its strange and not what we would expect.
>
> What version of SQL server are you running? Im using 2005 Enterprise
> here...
>
I think thats what they are using at my company
> Its just a really strange thing, the 100 is always ignored... I think
> it just needs a 2nd parameter there, even if its going to ignore it.
> Thats certainly what it looks like from the SQL thats being run
> anyway. I would have thought the GenerationType.IDENTITY would mean
> that it knows not to use it in SQL inserts/updates, but obviously not.
>
I assume that you have run a simple unit test to do an insert with
persist e.g.
def testOK = {
val na = new Author()
na.name = "HELLO THERE!!!!!"
Model.persist(na)
val authors = Model.createNamedQuery[Author]
("findAllAuthors").getResultList()
authors.foreach(author => {
println("name: "+author.name)
author.books.foreach(book => println(" title: "+book.title))
})
}
If you are still having problems, "mvn clean" your project, zip it up
and mail it to me - I'll run it tomorrow morning, when I get to work
Oliver
> Cheers
>
> Tim
> >
OK, the code is merged in and the latest version is attached. I made a few minor modifications to the JPA code that Oliver sent:
1. I made the openEM and closeEM methods abstract and protected. The idea is that the JPA class shouldn't be tied to the way the user wants to access JPA. Rather, when they implement the JPA class they can provide their own hooks to do direct access, IoC, or JNDI, etc.
2. I added a convenience method for createNamedQuery so that you can pass parameters in when you create the query. A very minor change but it saves a little typing when you use it a lot.
I've also changed the module naming per Oliver's suggestion. I'll test against the other DBs this afternoon, but so far I've had no issues with HSQLDB.