Is your backing bean deployed? It appears to be complaining about not finding the @Name(
person) backing bean. I'm assuming your oracle-ds.xml is implemented correctly and tnsnames is setup properly based on the fact that you can see the Oracle connection. The JBoss server.log output when application is deployed will probably help identify exactly what's the problem.
Thanks for the reply, Joe. How can I tell whether my backing bean is deployed? I'm not sure what to look for in the server.log, but I don't see any obvious problems there.
I posted my logs on my website, if you wouldn't mind taking a look at it, I'd be grateful:
Having a look at the example on the net, I can see that which ever database they are using for the example uses auto generated id's. Oracle uses sequences to generate id's for pk's.
Try this change the person class line:
@Id @GeneratedValue(strategy=SEQUENCE, generator="PERSON_SEQ")
Then log into SQL Plus and create the sequence:
SQL> CREATE SEQUENCE PERSON_SEQ;
I'm not sure, if the hibernate hbm2ddl creates sequences, personally I never use it.
But if you have this:
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
in your persistence.xml file, it should automatically drop and create tables/sequences/etc.
Hope this helps.
Also, try running your example and see if it's acutally creating the record in the person table.
If it is and the id is null then the above solution should work.
Acutally, it should fail when it tries to insert the record if the Id column is null as long as there is a PK constraint on that column.
I switched the datasource back to what it was originally /DefaultDS, and I still get the same error! So, I'm pretty confused now. It looks like persistence.xml is the only file I've touched. Maybe one of my other deploys has introduced a problem into this app? I will get a fresh copy of the sourcecode zip for the Yuan book and try again, once Yuan's website starts working again.