After pulling in Richard's latest changes everything seems to work as I expect it.
If you want to try take care of following gotchas:
1) start the sakila database
2) make sure your as7 instance has a h2 datasource deployed that corresponds to the sakila database:
-> put the driver jar (h2-1.3.161.jar) in the as7 deployment folder
->create a file 'sakila-ds.xml' with below contents and put it in the as7 deployment folder:
<?xml version="1.0" encoding="UTF-8"?>
<datasource jndi-name="java:jboss/datasources/sakila" enabled="true"
use-java-context="true" pool-name="HSQLDB">
<connection-url>jdbc:h2:tcp://localhost/sakila</connection-url>
<driver>h2-1.3.161.jar</driver>
<pool></pool>
<security>
<user-name>sa</user-name>
<password></password>
</security>
</datasource>
</datasources>
3) use the latest hibernate tools plugin available
4) use the correct settings when reverse engineering:
->table: *
->schema: *
->catalog: *
->entity package: my.test.sakila.model
->driver: org.h2.Driver
->path to driver: /Users/koen/Temp/sakila-h2/h2-1.3.161.jar
->user: sa
->password:
->dialect: org.hibernate.dialect.H2Dialect
->detect many to many: true
->detect one to one: true
->detect optimistic lock: true
5) after reverse engineering the db and scaffolding the ui and before deploying don't forget to edit the persistence.xml file:
-> delete or comment the line <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
-> change the jta-data-source <jta-data-source>java:jboss/datasources/sakila</jta-data-source>
After doing this, the app should work with the contents of the sakila database.
Cheers,
Koen
Op 21-mrt.-2012, om 00:17 heeft Thomas Frühbeck het volgende geschreven:
I tried hard to get the DB working, but I failed :-/
I am positively convinced that the faces scaffold is well prepared
to handle primitive types, only long seems to be unhandled.
If I could get the generated code I would try to fix any problem,
but my attempts at reverse engineering failed :-(
Thomas
Am 20.03.2012 20:19, schrieb Lincoln Baxter, III:
Hmm, ok.
I tried to get to the root cause of this issue, but since I am not
familiar with Metawidget, I hit a road block around line 265 of
FacesScaffold.java ( JavaClass viewBean =
JavaParser.parse(JavaClass.class,
this.backingBeanTemplate.render(context)); ) The template simply
takes Metawidget's contents and inserts it, I'm not sure how to
continue.
Thomas or Richard, any chance you could take a look at this
project (the result of running the new scaffold on a reverse
engineered database.) and see what we can do to resolve this
compliation issue?
It's specifically caused because the generated entities are using
primitive types (short, long) instead of object types for their ID
fields, so I guess we need to support both.
Thoughts? How easy is this to fix?
~Lincoln
--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."