HQL Console support for Hibernate annotations?
Can the HQL console in the Hibernate facet only be used with manual mapping files (.hbm.xml) - is there a way to have IDEA recognize the annotations?
Or does the facet only recognize Hibernate annotations (as opposed to JPA annotations)?
请先登录再写评论。
Hello Nick,
HQL console can be used in JPA & Hibernate facets.
It supports everything hibernate supports, i.e.
orm.xml, hbm.xml, JPA & Hibernate annotations.
Hibernate libs have to be present in module dependencies.
Greg
Nick Pratt wrote:
Thanks for the info. Ok, so I must be missing something here - I have both JPA and Hibernate facets on various modules - the Java EE view shows them, along with all the entities.
If I right click on one of the nodes, and select Open HQL console, and try and write any HQL query, such as
select f from Foo (where Foo is a confirmed valid table/entity),
I only ever receive the following error:
Foo is not mapped [select f from Foo f]
Query is not prepared
What step am I missing here, or what is IDEA trying to tell me?
What DB is the HQL console trying to use (the one associated with the project / entity?)
Regards
Nick
Hello Nick,
At the moment there is a bug in hibernate config generation.
JPA and Hibernate have different "unlisted annotated classes" policy.
So if you have pure JPA annotation mappings and the classes are not
listed in persistence.xml then you should list them there as follows:
]]>
This is fixed in the upcoming 8.1.1 EAP.
If this is not true for your configuration then I need to get a deeper
understanding of the situation.
Gregory Shrago
Nick Pratt wrote:
We try and use the JPA annotations where possible, falling back to the Hibernate specific ones when we need a feature that JPA doesn't support.
Our persistence.xml is empty (just the persistence unit specified), so it sounds like we are hitting this bug.
Is the requirement to list our annotated classes in persistence.xml purely as a workaround for this bug?
Thanks,
Nick
Nick Pratt wrote:
Yes it is. Next 8.1.1 EAP will make this workaround obsolete.
Gregory Shrago
Can someone confirm that this has been resolved?
I have been using a trial version , which I downloaded last week, in which the problem still occured.
If not, for which release the solution will be scheduled.
Thx,
Werner
I can confirm that in 8.1.3, that this is not working.
We have a hibernate.cfg.xml which in the Hibernate facets shows all the mapped entities, but when trying to run in the HQL console will always give the message that the object is not mapped and Query is not prepared.
Like the OP, we use the JPA Annotations and Hibernate specific when needed, but we do not have a persistence.xml, just a hibernate.cfg.xml
The code works in the app, but not in HQL Console.
Unfortunately, as much as I hate Eclipse, this is the one case where they seem to be a little bit better.
Hopefully this will get resolved real soon. I have a deadline tomorrow.
In the cold weather, the UGG boots are considered as the best shoes.More and more people like wearing the UGG boots such as the http://sell-ugg.com/UGG-Classic-Metallic-5812/c9/index.html.With its development ,the UGG boots have lauched different kinds of boots into the fashion market,including the http://uggboots-euro.com/UGG-Classic-Short-Boots/c3/index.html and the http://uggboots-euro.com/UGG-Women%27s-ighkoo/c23/index.html.However,in the fashion world,if you want to be more attractive and elegant,the beautiful shoes are not enough.You have to choose the best stylish handbag to match your shoes.Therefor,the designer replica handbags are very necessary.If you want to buy the best designer cheap handbags,i would like to introduce two famous brand handbags to you.I think there must be one handbag is your favorite.One is the famous brand http://www.famousbrandbag.com/Versace/c40/index.html,the other is the Ferragamo Handbags.Both of them are the famous brand in the world.Their quality are very good.
---
Original message URL: http://www.jetbrains.net/devnet/message/5254929#5254929