When using strategy=GenerationType.AUTO for Hibernate and primary keys, Hibernate delegates to your database to create primary keys. It indicates it wants one to be created by inserting a NULL. I believe your issues is happening because your schema didn't get created properly. Did you manually create the schema or use AppFuse and the Hibernate 3 plugin to do it?
Matt On Mon, Oct 5, 2009 at 7:12 AM, andreistoiculescu <andreistoicule...@yahoo.com> wrote: > > Hello, > > I have tried to setup appfuse 2 with Oracle10gXE, but when running the > integration tests I get the following three failures : > > Tests in error: > testAddAndRemoveUser(eastBanquet.dao.UserDaoTest) > testCRUD(eastBanquet.dao.UniversalDaoTest) > testAddAndRemoveRole(eastBanquet.dao.RoleDaoTest) > > If i study the surefire reports, I observe the following : > ...Caused by: java.sql.SQLException: ORA-01400: cannot insert NULL into > ("SYSTEM"."APP_USER"."ID")... > ...Caused by: java.sql.SQLException: ORA-01400: cannot insert NULL into > ("SYSTEM"."ROLE"."ID")... > > All the oracle objects (the tables and the sequence seem to have been > created fine, and the sample-data has been inserted into the tables). It > looks to me as if the saveUser(user), save(user) etc.. methods fail, because > the id is null, but I can't figure out why the id is null. > > This is my Oracle profile from the pom.xml : > > <profile> > <id>oracle</id> > <properties> > > <dbunit.dataTypeFactoryName>org.dbunit.ext.oracle.OracleDataTypeFactory</dbunit.dataTypeFactoryName> > <dbunit.schema>SYSTEM</dbunit.schema> <!-- Make sure to > capitalize the schema name --> > > <hibernate.dialect>org.hibernate.dialect.Oracle10gDialect</hibernate.dialect> > <jdbc.groupId>com.oracle</jdbc.groupId> > <jdbc.artifactId>ojdbc14</jdbc.artifactId> > <jdbc.version>10.2.0.2.0</jdbc.version> > > <jdbc.driverClassName>oracle.jdbc.OracleDriver</jdbc.driverClassName> > > <jdbc.url><![CDATA[jdbc:oracle:thin:@localhost:1521:XE]]></jdbc.url> > <jdbc.username>system</jdbc.username> > <jdbc.password>root</jdbc.password> > </properties> > </profile> > > and I am executing the following command : mvn -Poracle jetty:run-war > > This is the code in the User, as well as the Role class, for the id. > �...@id > �...@generatedvalue(strategy=GenerationType.AUTO) > public Long getId() { > return id; > } > > Thank you for the help, > > Andrei > -- > View this message in context: > http://www.nabble.com/Oracle-setup-fails-3-tests-%28cannot-insert-NULL-into-%28%22SYSTEM%22.%22APP_USER%22.%22ID%22%29%29-tp25750597s2369p25750597.html > Sent from the AppFuse - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net > For additional commands, e-mail: users-h...@appfuse.dev.java.net > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net For additional commands, e-mail: users-h...@appfuse.dev.java.net