-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping class to Table
PostPosted: Fri Jun 02, 2006 5:11 am 
Regular
Regular

Joined: Mon May 22, 2006 8:32 am
Posts: 67
Mapping documents:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">
com.sybase.jdbc2.jdbc.SybDriver
</property>
<property name="hibernate.connection.url">
jdbc:sybase:Tds:dems1op.de.office.aol.com:5015
</property>
<property name="hibernate.connection.username">user</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">
org.hibernate.dialect.SybaseDialect
</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Mapping files -->
<mapping resource="user.hbm.xml" />
</session-factory>
</hibernate-configuration>


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="de.aol.wfm.dbBean.User" table="VIEW_GERMAN_INTERNALS_IDP">
<id name="peoplesoft_id" type="long" column="peoplesoft_id" >
<generator class="increment"/>
</id>

<property name="screen_name">
<column name="screen_name" />
</property>

<property name="inhouse_login">
<column name="inhouse_login"/>
</property>
</class>
</hibernate-mapping>


Full stack trace of any exception that occurs:
28150 [http8080-Processor25] ERROR hql.parser - *** ERROR: VIEW_GERMAN_INTERNALS_IDP is not mapped.
28150 [http8080-Processor25] DEBUG hql.parser - VIEW_GERMAN_INTERNALS_IDP is not mapped.
VIEW_GERMAN_INTERNALS_IDP is not mapped.
at org.hibernate.hql.ast.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:81)
at org.hibernate.hql.ast.FromElementFactory.addFromElement(FromElementFactory.java:77)
at org.hibernate.hql.ast.FromClause.addFromElement(FromClause.java:71)
at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:223)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:2312)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2232)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:498)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:356)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:184)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:140)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:814)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:773)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at de.aol.wfm.dao.hibernateUtil.UserDaoHibernateImpl.getUser(UserDaoHibernateImpl.java:38)
at de.aol.wfm.services.UserService.doLogin(UserService.java:50)
at de.aol.wfm.bean.UserBean.doLogin(UserBean.java:172)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:790)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:709)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:572)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
at java.lang.Thread.run(Unknown Source)
28170 [http8080-Processor25] DEBUG org.hibernate.hql.ast.FromReferenceNode - Resolved : user -> user
28180 [http8080-Processor25] ERROR hql.parser - *** ERROR: Invalid path: 'user.inhouse_login'
28180 [http8080-Processor25] DEBUG hql.parser - Invalid path: 'user.inhouse_login'
Name and version of the database you are using:
sybase

The generated SQL (show_sql=true):
public User getUser(String username) {

//VIEW_GERMAN_INTERNALS_IDP user = null;
User user = null;
Session lsession = HibernateUtil.getSession(HibernateUtil.ESDB);


List users = lsession.createQuery("from VIEW_GERMAN_INTERNALS_IDP as user where user.inhouse_login = ?")
.setString(0, username)
.list();

Iterator it = users.iterator();

while (it.hasNext()){
user = new User();
user = (User) it.next();
}
return user;
}

My Problem: i try to query table "VIEW_GERMAN_INTERNALS_IDP". If i name the class also "<class name="de.aol.wfm.dbBean.VIEW_GERMAN_INTERNALS_IDP"> everthing is fine.
But i don't want to use such a long name. So i changed the class to
<class name="de.aol.wfm.dbBean.User"> in user-cfg.xml

That does not work as shown in above exception.

How to map my class "User" to table "VIEW_GERMAN_INTERNALS_IDP"?

Is it possible or do i have to use exactly the same name?

Thanks for advice,

regards,

a.k.


Top
 Profile  
 
 Post subject: Mapping class to Table
PostPosted: Fri Jun 02, 2006 5:40 am 
Newbie

Joined: Thu Apr 06, 2006 10:16 am
Posts: 6
Hello

Quote:
List users = lsession.createQuery("from VIEW_GERMAN_INTERNALS_IDP as user where user.inhouse_login = ?")
.setString(0, username)
.list();

Iterator it = users.iterator();

while (it.hasNext()){
user = new User();
user = (User) it.next();
}
return user;
}

My Problem: i try to query table "VIEW_GERMAN_INTERNALS_IDP". If i name the class also "<class name="de.aol.wfm.dbBean.VIEW_GERMAN_INTERNALS_IDP"> everthing is fine.
But i don't want to use such a long name. So i changed the class to
<class name="de.aol.wfm.dbBean.User"> in user-cfg.xml


Have you tried to write:

List users = lsession.createQuery("from de.aol.wfm.dbBean.User user where user.inhouse_login = ?")
.setString(0, username)
.list();

Regards

Daniel


Top
 Profile  
 
 Post subject: Mapping class to table
PostPosted: Fri Jun 02, 2006 5:45 am 
Regular
Regular

Joined: Mon May 22, 2006 8:32 am
Posts: 67
Hi again,

ok, i think the subject gave me the solution:

all i have to do is change the statement:
Code:
List users = lsession.createQuery("from VIEW_GERMAN_INTERNALS_IDP as user where user.inhouse_login = ?")

changed to:
List users = lsession.createQuery("from User as user where user.inhouse_login = ?")


Sorry for this!

Regards,

a.k.


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.