-->
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.  [ 13 posts ] 
Author Message
 Post subject: Eclipse Hib Console Config - entity is not mapped
PostPosted: Tue Jun 26, 2007 9:09 am 
Beginner
Beginner

Joined: Thu May 17, 2007 8:37 am
Posts: 22
Location: London
Hi,

I have a Seam project that uses Annotations rather than Hibernate mapping files. What is the best way to now point the Hibernate Console Config and HQL Editor to this project?

I have selected "Annotations" in the Console Configuration.

Everytime that i try I get an error in the Hibernate Query Result saying that "User is not mapped" (or whatever entity I am querying).

If I try to expand the "Configuration" tab under my named Hibernate Configuration, nothing appears - whereas the docs say that I should see my classes.

Any ideas?

Thanks,

Damian.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 26, 2007 11:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Depends.. ;)

If you want to use it as "Annotations" then you need to have a hibernate.cfg.xml that lists the entities - just as if with Hibernate Annotations

The other alternative is to make sure that Hibernate Tools can "see" a standard META-INF/persistence.xml in it's classpath. So make sure you have such file in your classpath and choosing EJB3/JPA should work.

(note you might be running into issues if your persistence.xml uses datasources isntead of hibernate connection info...so just make sure that is the case or list them in a separate xyz.properties and specify that as your properties files to use for overriding any defaults)

(not sure if this last works in b9 though)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 26, 2007 1:07 pm 
Beginner
Beginner

Joined: Thu May 17, 2007 8:37 am
Posts: 22
Location: London
Thanks Max.

My app was created with Seam-Gen so I had no hibernate.cfg.xml let alone any mappings.

I have tried the JPA mode and while I couldn't make it connect with an overriding properties file, it did when I specified the connection details in the persistence.xml. The downside is that it still experienced the same "is not mapped" error when attempting a Query.

When I expand the Database tree I can see all of the tables (this was the same previously)

Is there anything else that you can think of that I can try?

Has anyone got the Hibernate Tools working on a Seam-Gen project? If so what steps did you take?

Thanks,

Damian.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 27, 2007 1:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
try and uses the latest nightly build - it for sure will pickup the settings generated with seamgen (assuming you are using the latest seam beta)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 27, 2007 10:25 am 
Beginner
Beginner

Joined: Thu May 17, 2007 8:37 am
Posts: 22
Location: London
I've upped my versions to Eclipse 3.3.0 and Seam 1.3.0.ALPHA. If I Seam Gen a project it will automatically pick up the console config but it still can't map the files - even though it automagically chooses JPA. Still get the "is not mapped error"

Not too keen on trying Seam 2.0.BETA as it is too big a change for my project.

Have you tried this on a Seam-Gen project? Did it just work?

Thanks,

Damian.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 29, 2007 3:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Does META-INF/persistence.xml exist in your eclipse project classpath ?!

Then the mappings should definitly be picked up.

What can be tricky is that seam-gen's defaulted persistence.xml is using a datasource which we can't really use (it's appserver dependent) though later seam-gen's (most likely only in seam 2) generates an accompanying hibernate-console.properties to override the datasource and transaction settings to be JDBC driven instead.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 02, 2007 4:44 am 
Beginner
Beginner

Joined: Thu May 17, 2007 8:37 am
Posts: 22
Location: London
I regenerated my project using the latest Seam 2.0 BETA and now it just works. Fabulous to be able to prototype EJBQL queries like this.

I can't get some of my other older projects to be picked up (generated with previous versions of Seam Gen) even though they have the hibernate-console.properties and the persistence.xml on the classpath. I'm not too bothered with this as I can just use a newly generated stub to do the prototyping (and really should migrate I suppose).

Thanks for the help. All of this is very much appreciated.

Regards,

Damian.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 02, 2007 12:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the trick for the "autodiscovery" of the right configuraiton inside eclipse is the .launch file. Check it out and mimic its contents and you should reach nirvana in no time ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 30, 2007 9:32 am 
Newbie

Joined: Wed May 09, 2007 7:06 am
Posts: 12
hi damianharvey,

can you tell me the steps get working HQL queries from a seam-gen project inside the hibernate tools!!!


Would be very grateful



Thanks

_________________
Feivel Frey


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 30, 2007 9:35 am 
Beginner
Beginner

Joined: Thu May 17, 2007 8:37 am
Posts: 22
Location: London
I wish I could but it's all stopped working again. I've tried digging around through the '.launch' and hibernate-console.properties etc but gave up in frustration. The new RedHat Dev Studio didn't help either.

Sorry I can't be of more assistance.

Cheers,

Damian.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 31, 2007 4:25 am 
Newbie

Joined: Thu Aug 23, 2007 5:22 am
Posts: 3
Earlier this year I was involved in a EJB3/JSF project. For the purpose of prototyping query statements, I created a session bean (could be any RMI capable bean, I guess) with the following method signature:



public List doQuery(String query);





I made a client class that looked up this session bean and VOILA... prototyping queries without the Eclipse Wizard madness.




It is a sick hack that I do NOT recommend to use (how about "doQuery(//drop database here)"), but it worked well for me in a small team project.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 12, 2007 9:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
guys,

It works for me...so could you tell me the exact steps you do and what goes wrong ? thanks.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 12, 2007 9:32 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
guys,

It works for me...so could you tell me the exact steps you do and what goes wrong ? thanks.

_________________
Max
Don't forget to rate


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