-->
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.  [ 5 posts ] 
Author Message
 Post subject: configure Hibernate with SqlServer
PostPosted: Wed Nov 28, 2007 9:40 am 
Newbie

Joined: Wed Nov 28, 2007 9:36 am
Posts: 8
hi ,
i am getting an error message :

Code:
15:07:06,685 ERROR [STDERR] org.hibernate.MappingException: could not instantiate id generator
   at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:98)
   at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
   at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:192)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
   at com.mts.dblayer.HibernateTools.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:54)
....
...
Caused by: org.hibernate.MappingException: Dialect does not support sequences
   at org.hibernate.dialect.Dialect.getSequenceNextValString(Dialect.java:583)
   at org.hibernate.id.SequenceGenerator.configure(SequenceGenerator.java:65)


i created in reverse engineering the POJO + DAO + cfg.xml
the cfg.xml is :
Code:
<hibernate-mapping>
    <class entity-name="com.mts.dblayer.entities.WfNotes" table="WF_NOTES" schema="dbo" catalog="WorkFlow">
        <id name="keyNum" type="java.lang.Long">
            <column name="KEY_NUM" precision="18" scale="0" />
            <generator class="identity" />
        </id>
        <version name="version" type="java.lang.Long">
            <column name="VERSION" precision="10" scale="0" />
        </version>
        <property name="piKeyNum" type="java.lang.Long">
            <column name="PI_KEY_NUM" precision="18" scale="0" not-null="true" />
        </property>
        <property name="description" type="java.lang.String">
            <column name="DESCRIPTION" length="200" />
        </property>
        <property name="attachment" type="java.lang.String">
            <column name="ATTACHMENT" length="100" />
        </property>
        <property name="noteDate" type="java.util.Date">
            <column name="NOTE_DATE" length="23" />
        </property>
        <property name="entity" type="java.lang.String">
            <column name="ENTITY" length="50" />
        </property>
        <property name="creationDate" type="java.util.Date">
            <column name="CREATION_DATE" length="23" />
        </property>
        <property name="lastSubsysName" type="java.lang.String">
            <column name="LAST_SUBSYS_NAME" length="30" />
        </property>
        <property name="lastUserName" type="java.lang.String">
            <column name="LAST_USER_NAME" length="20" />
        </property>
        <property name="lastUpdateDate" type="java.util.Date">
            <column name="LAST_UPDATE_DATE" length="23" />
        </property>
        <property name="createdBy" type="java.lang.String">
            <column name="CREATED_BY" length="30" />
        </property>
    </class>
</hibernate-mapping>


pls advise .
Thanks,
Yair


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 28, 2007 10:04 am 
Beginner
Beginner

Joined: Fri May 18, 2007 10:28 am
Posts: 48
Location: Madison, WI
See if u can change
[code]<id name="keyNum" type="java.lang.Long">
<column name="KEY_NUM" precision="18" scale="0" />
<generator class="identity" />
</id> [/code]

to native.
It also depends on the database table definition. If it is automatically generated in the database level, assigned will take care of it.

http://www.hibernate.org/hib_docs/refer ... -sequences

In the above link, look @ section 5.1.4.

_________________
Please rate if it helped


Top
 Profile  
 
 Post subject: tried both solutions ....
PostPosted: Wed Nov 28, 2007 10:24 am 
Newbie

Joined: Wed Nov 28, 2007 9:36 am
Posts: 8
didn't work .
same error message ...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 28, 2007 10:35 am 
Beginner
Beginner

Joined: Fri May 18, 2007 10:28 am
Posts: 48
Location: Madison, WI
Can you send your table defn. DDL will help.

_________________
Please rate if it helped


Top
 Profile  
 
 Post subject: here it is the dll of the table
PostPosted: Wed Nov 28, 2007 10:39 am 
Newbie

Joined: Wed Nov 28, 2007 9:36 am
Posts: 8
create table "WorkFlow"."dbo"."WF_NOTES"(
"KEY_NUM" numeric(18) identity not null,
"PI_KEY_NUM" numeric(18) not null,
"DESCRIPTION" nvarchar(200) null,
"ATTACHMENT" nvarchar(100) null,
"NOTE_DATE" datetime null,
"ENTITY" nvarchar(50) null,
"CREATION_DATE" datetime null,
"LAST_SUBSYS_NAME" nvarchar(30) null,
"LAST_USER_NAME" nvarchar(20) null,
"LAST_UPDATE_DATE" datetime null,
"VERSION" numeric(10) default '((0))' null,
"CREATED_BY" varchar(30) null,
constraint "KEY_NUM" primary key ("KEY_NUM")
)
go

create unique index "KEY_NUM" on "WorkFlow"."dbo"."WF_NOTES"("KEY_NUM")
go


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

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.