possible hibernate bug

36 views
Skip to first unread message

Steve Rittler

unread,
Dec 30, 2015, 10:15:12 AM12/30/15
to Lucee
I've been working on porting one of our systems to Lucee and Postgres that makes heavy use of ORM. Ran in to one situation that I can't quite figure out. 

The entity ("Package") is mapped to a table ("package") with a serial datatype in the identity column ("packageID").

On insert, Hibernate attempts to pull out the latest generated id by querying:

select currval('"package"_packageID_seq')

Which, predictably, bombs. The escape chars around package should not be there.

select currval('package_packageID_seq') is what should be run.

I'm stumped as to what to tweak to make this work short of renaming the table to something that doesn't require escaping. I'd really like to not have to rewrite all of the reporting that taps that table.

Any suggestions?





Jon Clausen

unread,
Dec 30, 2015, 1:04:48 PM12/30/15
to lu...@googlegroups.com

Steve, How are you mapping that property. The following should work (which is how I map all serial id’s):

property name="packageId" column="id" fieldtype="id" generator="sequence" params="{sequence='package_packageId_seq'}" ormtype="integer" sqltype="serial";

--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/c402dbda-9c3d-4ae4-917b-cd6d3ec05414%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jon Clausen

unread,
Dec 30, 2015, 1:05:28 PM12/30/15
to lu...@googlegroups.com
Oops, that should use your naming conventions:

property name="packageId" column=“packageId" fieldtype="id" generator="sequence" params="{sequence='package_packageId_seq'}" ormtype="integer" sqltype="serial";

Steve Rittler

unread,
Dec 30, 2015, 2:59:21 PM12/30/15
to Lucee
I owe you a debt of gratitude. Thank you!

Not a Hibernate bug - clearly simply a gap in my understanding of how Postgres and Hibernate work together. I've never used the params attribute before but that makes a ton of sense now that I see it.

Now I know - and that's going to make a heck of a difference. Thanks again!

steve
Reply all
Reply to author
Forward
0 new messages