Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » @ReturnInsert(returnOnly=true) not working with PostgreSQL
@ReturnInsert(returnOnly=true) not working with PostgreSQL [message #496523] Tue, 10 November 2009 12:36 Go to next message
habakuk  is currently offline habakuk Friend
Messages: 32
Registered: October 2009
Member
Hi,

I tried to use the @returnInsert annotation

@ReturnInsert(returnOnly=true) 
protected Timestamp insertdate;


and got this exception:

Exception [EclipseLink-193] (Eclipse Persistence Services - 1.2.0.v20091016-r5565): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: There is no custom [InsertObjectQuery] set, but ReturningPolicy contains field(s) to be returned and [PostgreSQLPlatform] doesnt support generating call with returning.
Descriptor: RelationalDescriptor(ppd.model.entities.DVHist --> [DatabaseTable(DV_HIST)])
	at org.eclipse.persistence.exceptions.DescriptorException.noCustomQueryForReturningPolicy(DescriptorException.java:1855)
	at org.eclipse.persistence.descriptors.ReturningPolicy.validationAfterDescriptorInitialization(ReturningPolicy.java:871)
	at org.eclipse.persistence.descriptors.ClassDescriptor.selfValidationAfterInitialization(ClassDescriptor.java:3498)
	at org.eclipse.persistence.descriptors.ClassDescriptor.validateAfterInitialization(ClassDescriptor.java:5222)
	at org.eclipse.persistence.descriptors.ClassDescriptor.postInitialize(ClassDescriptor.java:3218)


I'd like to know how I can make this work with PostgreSQL

Thanks
Habakuk
Re: @ReturnInsert(returnOnly=true) not working with PostgreSQL [message #497138 is a reply to message #496523] Thu, 12 November 2009 15:35 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Returning using the "RETURNING" clause is currently only supported on Oracle. For other database native SQL is required for the INSERT/UPDATE to allow returning.

PostgreSQL does seem to have support for the "RETURNING" clause though, so please log a bug to have this support added.

You can customize your own subclass of the PostgreSQLPlatform yourself to add returning support. You need to override the methods, buildCallWithReturning and canBuildCallWithReturning.

I will looking into adding this support in the 2.0 stream.


James : Wiki : Book : Blog : Twitter
Re: @ReturnInsert(returnOnly=true) not working with PostgreSQL [message #498357 is a reply to message #497138] Mon, 16 November 2009 15:13 Go to previous message
habakuk  is currently offline habakuk Friend
Messages: 32
Registered: October 2009
Member
Done (Bug 295259)

Thanks James!
Previous Topic:case insensitive "order by"
Next Topic:proper Maven config?
Goto Forum:
  


Current Time: Wed Nov 26 09:18:34 GMT 2014

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

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