-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: SequenceGenerator not getting processed under some condition
PostPosted: Mon Dec 24, 2007 12:34 pm 
Newbie

Joined: Mon Jun 05, 2006 10:30 am
Posts: 7
Hi all,

i'm using hibernate entity manager and annotations.
i have an entity object with an id column defined like this:

Code:
@Id
    @Column(name = "id")
    @GeneratedValue(generator = "UserIdSeq")
    @SequenceGenerator(name = "UserIdSeq", sequenceName = "user_id_seq")
    public Long getId() {
        return _id;
    }


This seems to work fine in normal application execution.
When it doesn't work fine is when i try to unit test my DAOs. I'm using an in memory HSQL database for my tests and every time i try to create an entity i get this error:

Quote:
java.sql.SQLException: Attempt to insert null into a non-nullable column: column: ID table: USERS


The persistence.xml used to run the tests looks like this:

Code:
<persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
        <class>com.logical.sites.contentlibrary.data.database.User</class>
        <class>com.logical.sites.contentlibrary.data.database.Country</class>
        <class>com.logical.sites.contentlibrary.data.database.LoomyLicense</class>

        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
            <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
            <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:testdb://localhost:9001"/>
            <property name="hibernate.connection.username" value="sa"/>
            <property name="hibernate.connection.password" value=""/>
        </properties>
    </persistence-unit>


Any idea what might be wrong ?

Thanks in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.