Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-05-2008, 04:31 PM
Member
 
Join Date: Jan 2008
Posts: 4
narayanrec is on a distinguished road
Can I use annotations in superclass, and .cfg.xml files in subclasses in EJB3
Hi,

There is a common project, to which my application is going to interact. The common application is in JPA-using annotations in the model classes. Some of the model classes in my application is going to extend the common project's model classes. But my application uses .cfg.xml files for the model classes. So do I have to change the hibernate configuration files to annotations in my application, to make it work with common project?

I tried running a Junit, without changing the configuration files to annotations, but I am encountering errors in query. So I guess, this might be the problem - that I have to change the hibernate configuration files to annotations.

Please help.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-05-2008, 06:38 PM
Member
 
Join Date: Jan 2008
Posts: 20
maruthi_s is on a distinguished road
That should not be the case.. Can you paste the errors/exception you got.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-05-2008, 07:47 PM
Member
 
Join Date: Jan 2008
Posts: 4
narayanrec is on a distinguished road
I tried a lot of options but to no avail. See the error below.
java.lang.IllegalArgumentException: org.hibernate.QueryParameterException: could not locate named parameter [OLPARAM]
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl .java:185)
at com.bp.mobo.pricechecker.HibernateTestCase.loadGra deByName(HibernateTestCase.java:80)
at com.bp.mobo.pricechecker.HibernateTestCase.getGrad eId(HibernateTestCase.java:86)
at com.bp.mobo.pricechecker.server.dal.RequiredPriceD aoTestCase.setUp(RequiredPriceDaoTestCase.java:50)
at junit.framework.TestCase.runBare(TestCase.java:125 )
at junit.framework.TestResult$1.protect(TestResult.ja va: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:2 08)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit 3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:196)
Caused by: org.hibernate.QueryParameterException: could not locate named parameter [OLPARAM]
at org.hibernate.engine.query.ParameterMetadata.getNa medParameterDescriptor(ParameterMetadata.java:75)
at org.hibernate.engine.query.ParameterMetadata.getNa medParameterExpectedType(ParameterMetadata.java:81 )
at org.hibernate.impl.AbstractQueryImpl.determineType (AbstractQueryImpl.java:413)
at org.hibernate.impl.AbstractQueryImpl.setParameter( AbstractQueryImpl.java:383)
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl .java:180)
... 16 more
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 01-05-2008, 08:36 PM
Member
 
Join Date: Jan 2008
Posts: 20
maruthi_s is on a distinguished road
just checking ... did changing the annotations helped ..
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 01-06-2008, 03:40 AM
Member
 
Join Date: Jan 2008
Posts: 4
narayanrec is on a distinguished road
Actually the base class was using annotations, and the super classs was using .hbm.xml file for mapping with the database. In this case I don't require the base class annotations, as my super class takes care of mapping all the database columns. So I removed the annotations from the base class and tried executing the Junit, but to no use. It still complains the same thing. Now its the case that even .hbm.xml files are not working with Entity Manager. The next option for me would be to change to annotations and remove .hbm.xml files. But I don't see any reason why this shouldn't work, and moreover its additional effort to convert to annotations.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I use annotations in superclass, and .cfg.xml files in subclasses narayanrec Database 0 01-02-2008 05:24 AM
@ annotations mew New To Java 1 12-12-2007 12:04 PM
Annotations yogesh_SC Advanced Java 0 12-12-2007 09:43 AM
Hibernate subclasses Ed Database 2 07-02-2007 05:42 PM
Tables In Ejb3 Alan Enterprise JavaBeans 1 05-10-2007 05:36 PM


All times are GMT +3. The time now is 10:32 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org