-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Oracle mixed case column names
PostPosted: Tue Jan 08, 2008 11:33 am 
Newbie

Joined: Tue Jan 08, 2008 11:07 am
Posts: 1
Location: Eastern Virginia, US
Greetings,

I created a database and several tables in MySQL and developed an app using Hibernate and Seam. Later the decision was made to switch to Oracle. I am trying now to port to Oracle and continue to run into issues with mixed case column names.

I have tried backticks for column names and table name in the Entity bean to no avail.

Any and all help will be greatly appreciated.

Earnie!


When this code is executed:
Code:
         person = (Person) em.createQuery(
               "from Person where UserName = :userName").setParameter(
               "userName", user).getSingleResult();


I get this error:
Code:
2008-01-08 10:11:06,593 DEBUG [org.hibernate.SQL] select person0_.Id as Id41_, person0_.UserName as UserName41_, person0_.FirstName as FirstName41_, person0_.LastName as LastName41_ from "PERSON" person0_ where UserName=?
2008-01-08 10:11:06,593 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 2, globally: 2)
2008-01-08 10:11:06,593 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
2008-01-08 10:11:06,593 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 1, globally: 1) (open ResultSets: 0, globally: 0)]
2008-01-08 10:11:06,593 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not execute query [select person0_.Id as Id41_, person0_.UserName as UserName41_, person0_.FirstName as FirstName41_, person0_.LastName as LastName41_ from "PERSON" person0_ where UserName=?]
java.sql.SQLException: ORA-00904: "USERNAME": invalid identifier

   at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
   at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
   at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
   at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
   at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
   at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:799)
   at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1037)
   at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:839)
   at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1132)
   at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)
   at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3361)
   at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236)
   at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
   at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
   at org.hibernate.loader.Loader.doQuery(Loader.java:674)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
   at org.hibernate.loader.Loader.doList(Loader.java:2220)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
   at org.hibernate.loader.Loader.list(Loader.java:2099)
   at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
   at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
   at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
   at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:80)
   at org.ebsinc.waitc.ejb.Authenticator.authenticate(Authenticator.java:95)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
   at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
   at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
   at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
   at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:174)
   at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:108)
   at sun.reflect.GeneratedMethodAccessor141.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
   at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
   at javax.security.auth.login.LoginContext$5.run(LoginContext.java:706)
   at java.security.AccessController.doPrivileged(Native Method)
   at javax.security.auth.login.LoginContext.invokeCreatorPriv(LoginContext.java:703)
   at javax.security.auth.login.LoginContext.login(LoginContext.java:575)
   at org.jboss.seam.security.Identity.authenticate(Identity.java:335)
   at org.jboss.seam.security.Identity.authenticate(Identity.java:324)
   at org.jboss.seam.security.Identity.quietLogin(Identity.java:265)
   at org.jboss.seam.security.Identity.isLoggedIn(Identity.java:182)
   at org.jboss.seam.security.Identity.isLoggedIn(Identity.java:172)
   at org.ebsinc.waitc.ejb.Authenticator.checkLogin(Authenticator.java:301)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
   at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
   at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
   at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
   at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
   at org.ebsinc.waitc.ejb.Authenticator_$$_javassist_0.checkLogin(Authenticator_$$_javassist_0.java)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
   at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
   at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
   at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
   at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:174)
   at org.jboss.seam.navigation.Page.preRender(Page.java:264)
   at org.jboss.seam.navigation.Pages.preRender(Pages.java:309)
   at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:544)
   at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:455)
   at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:146)
   at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
   at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
   at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
   at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
   at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
   at java.lang.Thread.run(Thread.java:595)
2008-01-08 10:11:06,609 WARN  [org.hibernate.util.JDBCExceptionReporter] SQL Error: 904, SQLState: 42000
2008-01-08 10:11:06,609 ERROR [org.hibernate.util.JDBCExceptionReporter] ORA-00904: "USERNAME": invalid identifier

Here is my entity bean:
Code:
package org.ebsinc.waitc.entity;

// Generated Jan 7, 2008 3:41:43 PM by Hibernate Tools 3.2.0.beta8

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
* Person generated by hbm2java
*/
@Entity
@Table(name = "`PERSON`", uniqueConstraints = { @UniqueConstraint(columnNames = { "UserName" }) })
public class Person implements java.io.Serializable {

   // Fields   

   private long id;

   private String firstName;

   private String lastName;

   private String userName;

   // Constructors

   /** default constructor */
   public Person() {
   }

   /** minimal constructor */
   public Person(long id, String lastName, String userName) {
      this.id = id;
      this.lastName = lastName;
      this.userName = userName;
   }

   /** full constructor */
   public Person(long id, String firstName, String lastName, String userName) {
      this.id = id;
      this.firstName = firstName;
      this.lastName = lastName;
      this.userName = userName;
   }

   // Property accessors
   @Id
   @Column(name = "Id", unique = true, nullable = false, insertable = true, updatable = true, precision = 10, scale = 0)
   public long getId() {
      return this.id;
   }

   public void setId(long id) {
      this.id = id;
   }

   @Column(name = "FirstName", unique = false, nullable = true, insertable = true, updatable = true, length = 50)
   public String getFirstName() {
      return this.firstName;
   }

   public void setFirstName(String firstName) {
      this.firstName = firstName;
   }

   @Column(name = "LastName", unique = false, nullable = false, insertable = true, updatable = true, length = 50)
   public String getLastName() {
      return this.lastName;
   }

   public void setLastName(String lastName) {
      this.lastName = lastName;
   }

   @Column(name = "UserName", unique = true, nullable = false, insertable = true, updatable = true, length = 128)
   public String getUserName() {
      return this.userName;
   }

   public void setUserName(String userName) {
      this.userName = userName;
   }

}

Hibernate version: 3.2

Mapping documents: N/A

Code between sessionFactory.openSession() and session.close(): N/A

Full stack trace of any exception that occurs:

Name and version of the database you are using: Oracle 10g XE

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

_________________
Earnie Dyke
Virginia, US


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.