FOOM
FOOM

Reputation: 428

Removing quotes in openjpa generated sql for sybase

I need to be able to refer to a table on a different schema, using OpenJPA to access a Sybase db.

So, for example, I need to select as follows:

SELECT name FROM SHARE.dbo.PROVINCE; 

However, the generated SQL is:

SELECT name FROM "SHARE.dbo".PROVINCE; 

which Sybase rejects. Without the quotes it works fine.

I'm using the following annotations on the class:

@Entity
@Table(name="PROVINCE", schema="SHARE.dbo")

using schema="SHARE" doesn't work, although it generates the sql without any quotes. (Sybase requires schema.owner.table, so SCHEMA.PROVINCES is an unknown object)

Any thoughts on how to resolve this issue?

Upvotes: 0

Views: 129

Answers (2)

Rick
Rick

Reputation: 3840

This is a bit of a shot in the dark, but you could try to disable delimited identifier support?

openjpa.DBDictionary=sybase(SupportsDelimitedIdentifiers=false)

Upvotes: 1

tibtof
tibtof

Reputation: 7957

Try concatenating the schema to the table name: @Table(name="SHARE.dbo.PROVINCE")

Upvotes: 1

Related Questions