-->
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: SEVERE: *** ERROR: p.addresses is not mapped
PostPosted: Fri May 06, 2005 6:19 pm 
Newbie

Joined: Sun Apr 24, 2005 4:34 pm
Posts: 5
Hi,

Here is 2 lines of code, the first one is running, the second one generate an error. Why ???

I use Hibernate 3.0.2 and Spring 1.2rc2

Code:
// This one is OK
final Iterator it = getHibernateTemplate().find("select p from Person p, Address a where a.fk_pers = p.id_pers and a.zip = ? ", param).iterator();

// This one is KO
final Iterator it = getHibernateTemplate().find("from Person p, p.addresses where zip = ? ", param).iterator();

I have the next in the Person.hbm.xml
Code:
    <set
        name="addresses"
        lazy="true"
        inverse="true"
      cascade="all"
    >
        <key>
            <column name="FK_PERS" />
        </key>
        <one-to-many
            class="com.model.Address"
        />
    </set>
I have the next message:
...
INFO: Mapping collection: com.model.Person.addresses -> ADDRESS
May 6, 2005 10:52:10 PM org.hibernate.cfg.HbmBinder bindCollectionSecondPass
...

SEVERE: *** ERROR: p.addresses is not mapped.
org.springframework.orm.hibernate3.HibernateQueryException: p.addresses is not mapped. [from com.model.Person p, p.addresses where zip = ? ]; nested exception is org.hibernate.hql.ast.QuerySyntaxError: p.addresses is not mapped. [from com.model.Person p, p.addresses where zip = ? ]
org.hibernate.hql.ast.QuerySyntaxError: p.addresses is not mapped. [from com.model.Person p, p.addresses where zip = ? ]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:196)
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:422)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:822)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:782)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at org.springframework.orm.hibernate3.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:748)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:310)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:739)
at com.dao.hibernate.PersonDAOHibernate.findByZip(PersonDAOHibernate.java:90)
at com.dao.PersonDAOTest.testFindByZip(PersonDAOTest.java:63)
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:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
Caused by: p.addresses is not mapped.
at org.hibernate.hql.ast.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:85)
at org.hibernate.hql.ast.FromElementFactory.addFromElement(FromElementFactory.java:77)
at org.hibernate.hql.ast.FromClause.addFromElement(FromClause.java:67)
at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:217)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:2830)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2719)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:513)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:371)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
... 26 more


Why does it happening? Is it a bug or do i miss use Spring/Hibernate ?

(I have the same problem with jboss ejb 3.0 and same kind of syntax)

Thanks for your help.

JMi
Hibernate version:
3.0.2
Mapping documents:

<set
name="addresses"
lazy="true"
inverse="true"
cascade="all"
>
<key>
<column name="FK_PERS" />
</key>
<one-to-many
class="com.model.Address"
/>
</set>

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
I have the next message:
...
INFO: Mapping collection: com.model.Person.addresses -> ADDRESS
May 6, 2005 10:52:10 PM org.hibernate.cfg.HbmBinder bindCollectionSecondPass
...

SEVERE: *** ERROR: p.addresses is not mapped.
org.springframework.orm.hibernate3.HibernateQueryException: p.addresses is not mapped. [from com.model.Person p, p.addresses where zip = ? ]; nested exception is org.hibernate.hql.ast.QuerySyntaxError: p.addresses is not mapped. [from com.model.Person p, p.addresses where zip = ? ]
org.hibernate.hql.ast.QuerySyntaxError: p.addresses is not mapped. [from com.model.Person p, p.addresses where zip = ? ]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:196)
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:422)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:822)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:782)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at org.springframework.orm.hibernate3.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:748)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:310)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:739)
at com.dao.hibernate.PersonDAOHibernate.findByZip(PersonDAOHibernate.java:90)
at com.dao.PersonDAOTest.testFindByZip(PersonDAOTest.java:63)
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:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
Caused by: p.addresses is not mapped.
at org.hibernate.hql.ast.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:85)
at org.hibernate.hql.ast.FromElementFactory.addFromElement(FromElementFactory.java:77)
at org.hibernate.hql.ast.FromClause.addFromElement(FromClause.java:67)
at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:217)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:2830)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2719)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:513)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:371)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
... 26 more

Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 06, 2005 9:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Wow, this is simply ridiculous...

http://www.hibernate.org/hib_docs/v3/reference/en/html/queryhql.html#queryhql-from


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 07, 2005 5:42 am 
Newbie

Joined: Sun Apr 24, 2005 4:34 pm
Posts: 5
oops ;-)) you're rigth i have to read first


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