I guess it could be the lack of increment on null. you may have to use a
trigger to create the new sequence or use sequence.nextval on inserts.

I do not think oracle has an increment on null builtin thing.




andreistoiculescu wrote:
Ok, so first of all I tried creating a new SCHEMA manually, like Matt said,
but the same thing happened. <dbunit.dataTypeFactoryName>org.dbunit.ext.oracle.OracleDataTypeFactory</dbunit.dataTypeFactoryName>
                <dbunit.schema>APPFUSE</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>appfuse</jdbc.username>
                <jdbc.password>appfuse</jdbc.password>

Then, I annotated the id's like Fred said, having previously created the
sequences on the new schema and the same thing happened. (hbmddl2 still running even though I have
created the sequences manually I guess it alters them, because this is the
output in the console (drop, create) ).

This is how I annotated the ids:
@Id @GeneratedValue(strategy=GenerationType.AUTO,generator="AMPAPPS_SEQ")
@SequenceGenerator(name="AMPAPPS_SEQ", sequenceName="AMPAPPS_SEQ")
Still, the same test failures.


Fred Forester-2 wrote:

With oracle you need to use sequences.

@Id @GeneratedValue(strategy=AUTO,generator="AMPAPPS_SEQ")
     @SequenceGenerator(name="AMPAPPS_SEQ", sequenceName="AMPAPPS_SEQ")

then you need to create a sequence in oracle called AMPAPPS_SEQ
via a create sequence command



andreistoiculescu wrote:
Thank you for the reply.
I have used the hbm2ddl plugin.


mraible wrote:
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



---------------------------------------------------------------------
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

Reply via email to