-->
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: I can't use Customized Generator with Tomcat DataSource!
PostPosted: Wed Jul 07, 2004 3:42 am 
Newbie

Joined: Wed Jul 07, 2004 3:06 am
Posts: 3
Hibernate Version:2.1.4
Tomcat Version:4.1.30

I have configured my Tomcat DataSource JNDI with the follow code:
[code]
<Resource name="jdbc/quickhibernate" scope="Shareable" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/quickhibernate">
[/code]
I have write one jsp file to prove the Tomcat DataSource work fine.The Tomcat DataSource configration is ok!

So in hibernate.cfg.xml configuration file, i have setted the hibernate to use Tomcat DataSource.The setting code is listed :
[code]
<property name="connection.datasource">java:comp/env/jdbc/quickhibernate</property>
[/code]
Some other code please see the attached file,thanks!

I use the Cat example in the hibernate reference to see whether the hibernate work . I use "uuid.hex" generator to identify my cats.

It work well as hibernate reference show so.But i can't use "uuid.hex" as my real id identifier in my application.I want to use Customized Generator to generator my ID,so i implement the interface "net.sf.hibernate.id.TableGenerator" to be my own generator.
The related setting code in hbm.xml is list follow:
[code]
<generator class="com.michael.quickhibernate.beans.CBidGenerator">
<param name="table">GENERATORCB</param>
<param name="column">NEXT_HI_VALUE_COLUMN</param>
<param name="prefix">CAMX</param>
</generator>
[/code]
When i run my demo,the cat can not save into database.So i thought maybe it was something wrong on my customized Generator.I check my Generator class CBidGenerator and related table, they are not wrong.

I had to think that the problem may located at connection used by hibernate.
So i chang hibernate connection configuration to C3P0 DBCP. When i run my demo,the inconceivability event happened.The cat with customized generator work fine.

Why? Customized Generator can't run with JNDI DataSource connection?

Any reply will be appreciated! Thank very much for seeing this topic!


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.