-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem with name of an association (primer)
PostPosted: Thu Jul 28, 2005 7:52 am 
Newbie

Joined: Tue Jun 28, 2005 10:20 am
Posts: 15
Hello,
i have figured out, that you can not use the name 'primer' for a many-to-one association in case you want to make a query.

The mapping from below leads on my system (java 1.4.2 and Eclipse 3.1 with exadelstudiopro3.0.2preview) to the attached exeption.
I needed one day to figure out that i must change the name of the many-to-one association. The first attempt of renaming to refPrimer won't work either.
So i decided to rename to basePrimer and all went well.
Does someone know what is going on here?
Ciao,
Carsten

Hibernate version: 3.05

Mapping documents:
<hibernate-mapping package="cartest">
<class name="PCRPrimer" table="pcrprimer">
<id name="id" />
<property name="finalConcentration" />
<many-to-one name="primer" class="Primer" column="primerid"/>
</class>
<class name="Primer" table="primer">
<id name="primer" />
<property name="di" />
</class>
<query name="primerwithoutprotocol">Select primer from PCRPrimer pcrprimer right join pcrprimer.primer primer where pcrprimer.id is null</query>
</hibernate-mapping>

Full stack trace of any exception that occurs:
13:40:13,734 INFO org.hibernate.cfg.Environment: Hibernate 3.0.5
13:40:13,734 INFO org.hibernate.cfg.Environment: hibernate.properties not found
13:40:13,750 INFO org.hibernate.cfg.Environment: using CGLIB reflection optimizer
13:40:13,750 INFO org.hibernate.cfg.Environment: using JDK 1.4 java.sql.Timestamp handling
13:40:14,812 INFO org.hibernate.cfg.HbmBinder: Mapping class: cartest.PCRPrimer -> pcrprimer
13:40:14,906 DEBUG org.hibernate.cfg.HbmBinder: Mapped property: id -> id
13:40:14,937 DEBUG org.hibernate.cfg.HbmBinder: Mapped property: finalConcentration -> finalConcentration
13:40:15,078 DEBUG org.hibernate.cfg.HbmBinder: Mapped property: primer -> primerid
13:40:15,078 INFO org.hibernate.cfg.HbmBinder: Mapping class: cartest.Primer -> primer
13:40:15,078 DEBUG org.hibernate.cfg.HbmBinder: Mapped property: primer -> primer
13:40:15,078 DEBUG org.hibernate.cfg.HbmBinder: Mapped property: di -> di
13:40:15,078 DEBUG org.hibernate.cfg.HbmBinder: Named query: primerwithoutprotocol -> Select primer from PCRPrimer pcrprimer right join pcrprimer.primer primer where pcrprimer.id is null
13:40:15,671 INFO org.hibernate.dialect.Dialect: Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
13:40:15,687 INFO org.hibernate.transaction.TransactionFactoryFactory: Using default transaction strategy (direct JDBC transactions)
13:40:15,687 INFO org.hibernate.transaction.TransactionManagerLookupFactory: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
13:40:15,703 INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory: Using ASTQueryTranslatorFactory
13:40:15,718 DEBUG org.hibernate.exception.SQLExceptionConverterFactory: Using dialect defined converter
13:40:16,000 INFO org.hibernate.impl.SessionFactoryImpl: building session factory
13:40:16,000 DEBUG org.hibernate.impl.SessionFactoryImpl: Session factory constructed with filter configurations : {}
13:40:16,000 DEBUG org.hibernate.impl.SessionFactoryImpl: instantiating session factory with properties:[...]
13:40:18,187 WARN net.sf.ehcache.config.Configurator: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/E:/eclipse31.exadel302/workspace/baz/WebContent/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
13:40:19,093 DEBUG org.hibernate.impl.SessionFactoryObjectFactory: initializing class SessionFactoryObjectFactory
13:40:19,093 DEBUG org.hibernate.impl.SessionFactoryObjectFactory: registered: 06ee9787055d3e1c01055d3e29150000 (unnamed)
13:40:19,093 INFO org.hibernate.impl.SessionFactoryObjectFactory: Not binding factory to JNDI, no JNDI name configured
13:40:19,109 DEBUG org.hibernate.impl.SessionFactoryImpl: instantiated session factory
13:40:19,109 INFO org.hibernate.impl.SessionFactoryImpl: Checking 1 named queries
13:40:19,109 DEBUG org.hibernate.impl.SessionFactoryImpl: Checking named query: primerwithoutprotocol
13:40:19,250 DEBUG org.hibernate.hql.ast.QueryTranslatorImpl: parse() - HQL: Select primer from cartest.PCRPrimer pcrprimer right join pcrprimer.primer primer where pcrprimer.id is null

13:40:19,296 DEBUG org.hibernate.hql.ast.AST: --- HQL AST ---
\-[QUERY] 'query'
+-[SELECT_FROM] 'SELECT_FROM'
| +-[FROM] 'from'
| | +-[RANGE] 'RANGE'
| | | +-[DOT] '.'
| | | | +-[IDENT] 'cartest'
| | | | \-[IDENT] 'PCRPrimer'
| | | \-[ALIAS] 'pcrprimer'
| | \-[JOIN] 'join'
| | +-[RIGHT] 'right'
| | +-[DOT] '.'
| | | +-[IDENT] 'pcrprimer'
| | | \-[IDENT] 'primer'
| | \-[ALIAS] 'primer'
| \-[SELECT] 'Select'
| \-[IDENT] 'primer'
\-[WHERE] 'where'
\-[IS_NULL] 'is null'
\-[DOT] '.'
+-[IDENT] 'pcrprimer'
\-[IDENT] 'id'

13:40:19,296 DEBUG org.hibernate.hql.ast.ErrorCounter: throwQueryException() : no errors
13:40:19,375 DEBUG org.hibernate.hql.antlr.HqlSqlBaseWalker: query() << begin, level = 1
13:40:19,437 DEBUG org.hibernate.hql.ast.FromElement: FromClause{level=1} : cartest.PCRPrimer (pcrprimer) -> pcrprimer0_
13:40:19,453 DEBUG org.hibernate.hql.ast.FromReferenceNode: Resolved : pcrprimer -> pcrprimer0_.id
13:40:19,453 DEBUG org.hibernate.hql.ast.DotNode: getDataType() : primer -> org.hibernate.type.ManyToOneType(cartest.Primer)
13:40:19,453 DEBUG org.hibernate.hql.ast.DotNode: dereferenceShortcut() : property primer in cartest.PCRPrimer does not require a join.
13:40:19,453 DEBUG org.hibernate.hql.ast.FromReferenceNode: Resolved : pcrprimer.primer -> pcrprimer0_.primerid
13:40:19,453 ERROR cartest.HibernateUtil: Building SessionFactory failed.
java.lang.NullPointerException
at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:264)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3022)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:2841)
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)
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:427)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:388)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:291)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
at cartest.HibernateUtil.<clinit>(HibernateUtil.java:37)
at cartest.PrimerDAO.findCarsWithoutProtocol(PrimerDAO.java:19)
at cartest.Main.main(Main.java:12)
java.lang.NoClassDefFoundError
at cartest.PrimerDAO.findCarsWithoutProtocol(PrimerDAO.java:24)
at cartest.Main.main(Main.java:12)


Top
 Profile  
 
 Post subject: Re: Problem with name of an association (primer)
PostPosted: Thu Sep 29, 2005 8:49 am 
Regular
Regular

Joined: Sat Sep 03, 2005 9:07 am
Posts: 87
Location: Graz, AUSTRIA
Hi Carsten!

Although you posted that 3 months ago, I got the same error and I solved it by using the 3.1 beta 3 Version.
But I'm not so happy to use a Beta Version and so I was looking for a solution and found your post.
But I don't really understand what you changed the join worked with 3.0.5

Perhaps could you explain
THX!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.