Application acting differently in regards to hibernate when
jej2003 Apr 8, 2008 10:10 AMI have a sample application (adapted from http://www.eclipse.org/webtools/dali/docs/tutorial_1.0/dali_jsf_tutorial.htm) that I am running on JBoss. When I run the application with a persistence.xml file that specifies the JDBC connection everything works, but if I change the persistence.xml file to use a JNDI name that is being mapped by JBoss I can read data fine, but when I attempt to insert data I get the error detailed below.
Persistence.xml file that does not work:
<?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="default" transaction-type="RESOURCE_LOCAL"> <jta-data-source>java:DaliDS</jta-data-source> <class>org.eclipse.dali.example.jsf.inventory.model.Inventory</class> <class>org.eclipse.dali.example.jsf.inventory.model.Item</class> <class>org.eclipse.dali.example.jsf.inventory.model.Order</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> <property name="hibernate.hbm2dll.auto" value="update"/> </properties> </persistence-unit>
Persistence.xml file that does work:
<?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="default"> <class>org.eclipse.dali.example.jsf.inventory.model.Inventory</class> <class>org.eclipse.dali.example.jsf.inventory.model.Item</class> <class>org.eclipse.dali.example.jsf.inventory.model.Order</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> <property name="hibernate.hbm2dll.auto" value="update"/> <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.ClientDriver"/> <property name="hibernate.connection.url" value="jdbc:derby://localhost:1527/sample;create=true"/> <property name="hibernate.connection.username" value="dali"/> <property name="hibernate.connection.password" value="dali"/> </properties> </persistence-unit>
Is hibernate configured to work differently when run under jboss?