-
1. Re: Target Unreachable when switching jndi reference to Oracle database
joe May 14, 2008 1:47 AM (in response to hotwater)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. -
2. Re: Target Unreachable when switching jndi reference to Oracle database
hotwater May 14, 2008 2:37 AM (in response to hotwater)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:
-
3. Re: Target Unreachable when switching jndi reference to Oracle database
mcoffin May 14, 2008 5:47 PM (in response to hotwater)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
to this:
@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.
-
4. Re: Target Unreachable when switching jndi reference to Oracle database
mcoffin May 14, 2008 5:50 PM (in response to hotwater)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.
-
5. Re: Target Unreachable when switching jndi reference to Oracle database
mcoffin May 14, 2008 6:09 PM (in response to hotwater)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.
-
6. Re: Target Unreachable when switching jndi reference to Oracle database
hotwater May 14, 2008 6:47 PM (in response to hotwater)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.