dev@glassfish.java.net

FW: RE: RE: Re: TLE vs Hibernate

From: Jason Lee <lee_at_iecokc.com>
Date: Fri, 16 Mar 2007 13:32:11 -0500

Cross posting: is this a bug, or am I missing something subtle?


-----
Jason Lee, SCJP
Senior Software Engineer
http://www.iec-okc.com

-----Original Message-----
From: Jason Lee
Sent: Friday, March 16, 2007 1:17 PM
To: users_at_glassfish.dev.java.net
Subject: RE: RE: Re: TLE vs Hibernate

I upgraded this morning to the b40 nightly for 3/16. When I try to add
a record, I got the null value exception, so I added
"nextval('engineers_seq')" as the default value to the PK field. That
solved the insert issue, but it appears the TopLink is trying to read
the sequence value back out, getting me this odd error:

Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b40-rc
(03/15/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: relation
"engineers_id_seq" does not existError Code: 0 Call:select
currval('engineers_ID_seq')

Confusing, as I specify the generator with:

@SequenceGenerator(name = "ENGINEERS_SEQ", allocationSize = 1,
sequenceName = "engineers_seq")

What am I missing? :|

-----
Jason Lee, SCJP
Senior Software Engineer
http://www.iec-okc.com
 

> -----Original Message-----
> From: Jason Lee
> Sent: Friday, March 16, 2007 8:46 AM
> To: users_at_glassfish.dev.java.net
> Subject: RE: Re: TLE vs Hibernate
>
> In my testing, I'm using Sun Java System Application Server
> 9.1 (build b38-rc). In production, though, we're still on v1 ur1 p01.
>
> -----
> Jason Lee, SCJP
> Senior Software Engineer
> http://www.iec-okc.com
>
>
> > -----Original Message-----
> > From: Marina.Vatkina_at_Sun.COM [mailto:Marina.Vatkina_at_Sun.COM]
> > Sent: Thursday, March 15, 2007 5:55 PM
> > To: users_at_glassfish.dev.java.net
> > Subject: Re: TLE vs Hibernate
> >
> > Jason,
> >
> > Are you using the latest v2 build?
> >
> > thanks,
> > -marina
> >
> > Jason Lee wrote:
> > > In all of our apps, we are currently using Hibernate as the JPA
> > > provider due to what we (read as, I) understood to be a
> bug in TLE
> > > with regard to SequenceGenerators and PostgreSQL. I'd
> > really like to
> > > use TLE, as I'm not a big fan of the extra configuration step in
> > > setting up our applications, nor am I, as our de facto GlassFish
> > > admin, a big fan of the extra installation step of adding
> > the Hibernate jars to the server.
> > > Those are two points of failure I'd like to avoid. To
> that end, I
> > > started testing an app of mine using TLE and hit a snag.
> > Here's part
> > > of my entity POJO:
> > >
> > > @Entity
> > > @Table(name = "engineers")
> > > @SequenceGenerator(name = "ENGINEERS_SEQ", allocationSize = 1,
> > > sequenceName = "engineers_seq") public class Engineer implements
> > > Serializable {
> > > @Id
> > > @GeneratedValue(strategy = GenerationType.SEQUENCE,
> generator =
> > > "ENGINEERS_SEQ")
> > > protected Integer id;
> > > With Hibernate, when I would create a new Engineer
> object, i could
> > > just call entityManager.persist(engineer) and be done with
> > it. When
> > > switch to TLE, the database barks because the ID has not
> been set.
> > > Short of changing the tables to have a default value of
> > > nextval($SEQ_NAME), how do I approach this using TLE?
> > >
> > > I even tried this:
> > >
> > > @Id
> > > @SequenceGenerator(name = "ENGINEERS_SEQ",
> allocationSize = 1,
> > > sequenceName = "engineers_seq")
> > > @GeneratedValue(strategy = GenerationType.SEQUENCE,
> generator =
> > > "ENGINEERS_SEQ")
> > > @Column
> > > protected Integer id;
> > > based on the documentation here
> > >
> >
> http://www.oracle.com/technology/products/ias/toplink/jpa/resources/to
> > > plink-jpa-annotations.html#SequenceGenerator with no love. :)
> > >
> > > -----
> > > Jason Lee, SCJP
> > > Senior Software Engineer
> > > http://www.iec-okc.com <http://www.iec-okc.com/>
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> > For additional commands, e-mail: users-help_at_glassfish.dev.java.net
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: users-help_at_glassfish.dev.java.net