That doesn’t work. It isn’t a field in the database but the SQL generated for other queries is trying to fill this column. Here’s the error message when I used:
@Column(name="userName", insertable=false, updatable=false)
Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00904: "USERSNAME": invalid identifier
[EL Finest]: query: 2012-07-03 14:53:35.774--UnitOfWork(22569861)--Thread(Thread[http-8080-1,5,main])--Execute query ReadObjectQuery(name="readObject" referenceClass=Users sql="SELECT USERID, ACCESSIBILITY_FLAG, ALL_EMAIL_RECIPIENT_FLAG,
DEFAULT_PASSWORD, EDMR_ADMIN_FLAG, EMAIL_ADDRESS, FIRST_NAME, LAST_NAME, MIDDLE_INITIAL, SIGNATURE, UPDATED_BY_USERID, UPDATED_DATE, USER_STATUS, usersName FROM USERS WHERE (USERID = ?)")
[EL Finest]: connection: 2012-07-03 14:53:35.789--ServerSession(28870257)--Connection(19982738)--Thread(Thread[http-8080-1,5,main])--Connection acquired from connection pool [default].
[EL Fine]: sql: 2012-07-03 14:53:35.789--ServerSession(28870257)--Connection(19982738)--Thread(Thread[http-8080-1,5,main])--SELECT USERID, ACCESSIBILITY_FLAG, ALL_EMAIL_RECIPIENT_FLAG, DEFAULT_PASSWORD, EDMR_ADMIN_FLAG, EMAIL_ADDRESS, FIRST_NAME,
LAST_NAME, MIDDLE_INITIAL, SIGNATURE, UPDATED_BY_USERID, UPDATED_DATE, USER_STATUS, usersName FROM USERS WHERE (USERID = ?)
bind => [WW116606]
[EL Fine]: sql: 2012-07-03 14:53:35.961--ServerSession(28870257)--Thread(Thread[http-8080-1,5,main])--SELECT 1 FROM DUAL
[EL Finest]: connection: 2012-07-03 14:53:36.008--ServerSession(28870257)--Connection(19982738)--Thread(Thread[http-8080-1,5,main])--Connection released to connection pool [default].
[EL Warning]: 2012-07-03 14:53:36.008--UnitOfWork(22569861)--Thread(Thread[http-8080-1,5,main])--Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00904: "USERSNAME": invalid identifier
Error Code: 904
Michele Cozart
Senior Programmer Analyst, Natural Resources Application Development
State of
Maine, Office of Information Technology
michele.l.cozart@maine.gov
207-287-7872 (Desk)
Confidentiality Notice: This email message, including any attachments, is for the sole use of the intended recipients and may contain
confidential and privileged information. If you are not the intended recipient, or an authorized agent of the intended recipient, please immediately contact the sender by reply email and destroy/delete all copies of the original message. Any unauthorized review,
use, copying, forwarding, disclosure, or distribution by other than the intended recipient or authorized agent is prohibited. – required
From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx]
On Behalf Of Sean Adkinson
Sent: Tuesday, July 03, 2012 2:44 PM
To: EclipseLink User Discussions
Subject: Re: [eclipselink-users] FetchGroups with a transient attribute
If you need to retrieve it, it can't be transient. Probably mark it @Column(name="userName", insertable=false, updatable=false).