Very cool. It worked, too. 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 <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> 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> > </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. > > Charles F. Munat wrote: > > Hot damn. I installed Lift using mvn install on my local copy, > and went > > back to the webapp and ran mvn jetty:run -U and IT RUNS. I now have > > "Welcome to the super duper catalog!" at localhost:9090. > > > > 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 <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 <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > >> <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote: > >> > >> > >> OK, did that, and mvn test ran successfully. > >> > >> > >> Phew! I was really confused as to how that could have gone wrong. > >> > >> > >> > >> > >> Am I missing something? > >> > >> > >> Yes. The first missing dependency is the perscala project. I > forgot that > >> step. You need to run "mvn install" from the perscala module to > install > >> the persistence jar. Any maven gurus out there with a suggestion > on how > >> to get this done automatically would be appreciated. The second > >> dependency is on the SNAPSHOT version of liftweb. I don't know > if it's > >> published in the repos, so you might need to check out a copy of the > >> SNAPSHOT version from Git and then install that into your repo > by doing > >> a "mvn install" there. This is part of the reason that I was holding > >> back; another is that if the API changes it breaks the code, but > neither > >> of these is a huge deal. > >> > >> Derek > >> > > > > > > > > > > >
--~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---