Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Conditional Sequence Generator Selection
Conditional Sequence Generator Selection [message #948199] Wed, 17 October 2012 17:18 Go to next message
Eclipse UserFriend
I'm still a JPA neophyte but starting to get the hang of things.

Attempting to integrate JPA with a legacy RDBMS supporting both SQL Server and Oracle. For Oracle, we use sequences and for SQL, a table.

I need to be able to conditionally use one of two generators based on database type:

Oracle

@Id
@GeneratedValue(generator="generator")
@SequenceGenerator(name="generator", sequenceName="PBX_SEQ", allocationSize=1)
@Column(name="PBX_ID")
protected long pbxId;

SQL Server

@Id
@GeneratedValue(generator="generator")
@TableGenerator(name="generator", table="SEQTAB", pkColumnName="TABLENAM", valueColumnName="ID", pkColumnValue="PBX", allocationSize=1)
@Column(name="PBX_ID")
protected long pbxId;

How best would one approach this challenge?

Thanks.
Re: Conditional Sequence Generator Selection [message #964538 is a reply to message #948199] Tue, 30 October 2012 11:57 Go to previous message
Eclipse UserFriend
You could use a SessionCustomizer to configure these in code on the Sesssion's login.
Previous Topic:turn off all caching
Next Topic:Where is now isolation property of @cache in eclipslink 2.4.1
Goto Forum:
  


Current Time: Wed Jul 23 03:44:29 EDT 2025

Powered by FUDForum. Page generated in 0.35039 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top