-->
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.  [ 8 posts ] 
Author Message
 Post subject: Sequence
PostPosted: Tue Feb 17, 2004 11:35 am 
Beginner
Beginner

Joined: Tue Feb 03, 2004 4:53 pm
Posts: 28
Ok here goes --
Got Hibernate working with Jboss and oracle...
each table has a specific sequence/table Id...
Person (table) has a Person_SQ for sequence on ids

I have a person Object with Person.hbm.xml of:
[code]
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin

http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->

<class
name="com.ata.hibernate.databean.Person"
table="PERSON"
>

<id
name="id"
type="java.math.BigDecimal"
column="ID"
>
<generator class="sequence">


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2004 11:48 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Sounds like you saved your xml file in a tricky encoding.

Try adding explicit encoding in the xml header (UTF-8, ISO-8859-1, etc

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2004 11:53 am 
Beginner
Beginner

Joined: Tue Feb 03, 2004 4:53 pm
Posts: 28
emmanuel wrote:
Sounds like you saved your xml file in a tricky encoding.

Try adding explicit encoding in the xml header (UTF-8, ISO-8859-1, etc


here is the header ---
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2004 12:03 pm 
Beginner
Beginner

Joined: Tue Feb 03, 2004 4:53 pm
Posts: 28
This problem did not start until I setup the sequence under the Id's


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2004 1:28 pm 
Beginner
Beginner

Joined: Tue Feb 03, 2004 4:53 pm
Posts: 28
Using Hibernate 2.1 final

Defined -- the above -- changed it to the following
[code]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin

http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->

<class
name="com.ata.hibernate.databean.Person"
table="PERSON"
>

<id
name="id"
type="long"
column="ID"
>
<generator class="native">
<param>PERSON_SQ</param>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2004 2:27 pm 
Beginner
Beginner

Joined: Tue Feb 03, 2004 4:53 pm
Posts: 28
This might help !
Platform = Jboss & Oracle8
Application structure =
EAR--
|-hibernate.cfg.xml
|-himbernate.properties
|-hibernateXML/
|-Person.hbm.xml
|-EJB-jar
|-META-INF
|-lib
|-hibernateClasses.jar -- Containes the Hibernate generated classes.
|-Other Hibernate dependent jar files
|-com/ (Session Beans)
|-WAR--
|WEB-INF
|--classes --Contains a single servlet only

with this construct the hibernate cfg.xml and properties files are availible to all under the Application as well as the hbm.xml files since the application layor is the root of the application in regards to classpath.

I have a singleton in the hibernateClasses.jar which is responsible to initializing a single SessionFactory, it is called by the EJB layor..

Can any one understand why I am getting the above exceptions ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2004 2:35 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Code:
<generator class="sequence">
  <param name="sequence">MYSEQ</param>
</...>

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2004 7:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Not sure what version of the MIddlegen Plugin your using but I tested it to make sure it was generating the correct hbm for a sequence id generator. It was correctly mapped. Have you hand edited the Hbm?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.