Quantcast

Mapping to Oracle

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Mapping to Oracle

Penguin_Buddha
This post was updated on .
I'm trying to set up my web app to be able to use GORM to access an existing oracle database. It seems to work in some ways but I'm getting the following error:

Error 500: Executing action [list] of controller [timesheet.LeaveRequestController] caused exception: could not execute 
query; SQL [select this_.REQ_ID as REQ1_0_0_, this_.version as version0_0_, this_.REQ_APPROVED as REQ3_0_0_, 
this_.REQ_APPROVED_BY as REQ4_0_0_, this_.REQ_APPROVED_DT as REQ5_0_0_, this_.REQ_COMMSERV_CODE as 
REQ6_0_0_, this_.REQ_DESC as REQ7_0_0_, this_.REQ_DONATE_TO as REQ8_0_0_, this_.REQ_END as REQ9_0_0_, 
this_.REQ_LEAVE_CODE as REQ10_0_0_, this_.REQ_PIDM as REQ11_0_0_, this_.REQ_START as REQ12_0_0_, 
this_.REQ_USER_ID as REQ13_0_0_ from LREQUEST this_ where (this_.REQ_USER_ID=?)]; nested exception is 
org.hibernate.exception.SQLGrammarException: could not execute query
Servlet: grails
URI: /TimeSheet/grails/leaveRequest/list.dispatch
Exception Message: ORA-00904: "THIS_"."VERSION": invalid identifier 
Caused by: ORA-00904: "THIS_"."VERSION": invalid identifier 
Class: LeaveRequestController 
At Line: [25] 

Line 25 is:
userLeaveRequestList = LeaveRequest.findAllWhere(userName: session?.getAttribute(CASFilter.CAS_FILTER_USER))

I think the issue may be with how I mapped my domain classes:
String pidm, approvedBy, description, userName, donateTo
	Date startDate, endDate, approvedDate
	LeaveType leaveType
	CommunityServiceType communityServiceType
	Boolean approved
	
	static mapping = {
		table 'LREQUEST'
		id column: 'REQ_ID', index:'APPCLASSPHOTOS.LREQUEST_SEQ'
		pidm column: 'REQ_PIDM'
		startDate column: 'REQ_START'
		endDate column: 'REQ_END'
		description column: 'REQ_DESC'
		leaveType column: 'REQ_LEAVE_CODE'
		communityServiceType column: 'REQ_COMMSERV_CODE'
		donateTo column: 'REQ_DONATE_TO'
		userName column: 'REQ_USER_ID'
		approvedBy column: 'REQ_APPROVED_BY'
		approvedDate column: 'REQ_APPROVED_DT'
		approved column: 'REQ_APPROVED'
	}

Am I correctly mapping the ID value?

Thanks for any aid.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Mapping to Oracle

longwa
I'm not sure everything pasted into the email. Can you try again?

We use Oracle with no real problems.

On Thu, Jun 21, 2012 at 12:03 PM, Penguin_Buddha <[hidden email]> wrote:
I'm trying to set up my web app to be able to use GORM to access an existing
oracle database. It seems to work in some ways but I'm getting the following
error:



Line 25 is:


I think the issue may be with how I mapped my domain classes:


Am I correctly mapping the ID value?

Thanks for any aid.

--
View this message in context: http://grails.1312388.n4.nabble.com/Mapping-to-Oracle-tp4630498.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Mapping to Oracle

longwa
Actually, the nabble version has the text.

I think the problem is that your legacy table doesn't have the version column (which is used for optimistic locking).

Try adding this to your mapping block right below the table name:

version false


On Thu, Jun 21, 2012 at 12:26 PM, Aaron Long <[hidden email]> wrote:
I'm not sure everything pasted into the email. Can you try again?

We use Oracle with no real problems.


On Thu, Jun 21, 2012 at 12:03 PM, Penguin_Buddha <[hidden email]> wrote:
I'm trying to set up my web app to be able to use GORM to access an existing
oracle database. It seems to work in some ways but I'm getting the following
error:



Line 25 is:


I think the issue may be with how I mapped my domain classes:


Am I correctly mapping the ID value?

Thanks for any aid.

--
View this message in context: http://grails.1312388.n4.nabble.com/Mapping-to-Oracle-tp4630498.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Mapping to Oracle

Penguin_Buddha
Setting version to false worked, though I assume that disables any optimistic locking as well?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Mapping to Oracle

Ian Roberts
In reply to this post by longwa
On 21/06/2012 17:29, Aaron Long wrote:
> Actually, the nabble version has the text.

Yes, it' a Nabble bug that I really wish they'd fix...

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Mapping to Oracle

longwa
Well, if you have a column in your database that could be used instead of version, you can use it:

version 'columnName'

Obviously, the best approach if you have control of the schema is to just add a version column.

-Aaron

On Thu, Jun 21, 2012 at 1:51 PM, Ian Roberts <[hidden email]> wrote:
On 21/06/2012 17:29, Aaron Long wrote:
> Actually, the nabble version has the text.

Yes, it' a Nabble bug that I really wish they'd fix...

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Loading...