Persistence with Hibernate Annotations

Hi,

Is there any way to configure the Hibernate facet to read annotations instead of hibernate.cfg ? There was a trick in Idea 6 where you could create a META-INF/persistence.xml file. Tried on Selena, and it automatically creates a JPA facet. The problem is that it requires a datasource, which I cannot provide (do not wish), therefore Selena (and Idea 6) highlights things like
@Column(name="name") as errors (cannot resolve column "name").

5 comments
Comment actions Permalink

In the facet configuration simply disable the validation.

0
Comment actions Permalink

It does not seem to do the trick : I'm still getting the errors and whenever I restart Selena, validation is turned on (validation is off in the .iml file when I shutdown idea, then on after beeing loaded).

0
Comment actions Permalink

Hi Cedric,

Hibernate Facet takes annotations into consideration if a module
language level is Java 5.
Annotated classes should be specified in or tags in ]]>.

No fake JPA facet/persistence.xml are needed.

To get rid of [cannot resolve column "name"] errors you can turn off the
inspection.

Regards,
Gregory Shrago

Cedric Champeau wrote:

Hi,

Is there any way to configure the Hibernate facet to read annotations
instead of hibernate.cfg ? There was a trick in Idea 6 where you
could create a META-INF/persistence.xml file. Tried on Selena, and it
automatically creates a JPA facet. The problem is that it requires a
datasource, which I cannot provide (do not wish), therefore Selena
(and Idea 6) highlights things like @Column(name="name") as errors
(cannot resolve column "name").

0
Comment actions Permalink

I was able to fix this problem by opening up the inspection options on the redlined column name annotion and editing the datasource. I found out that it had lost its reference to my db driver jar file. Once I fixed the datasource, I refreshed the datasource successfully (can do from Alt-Enter popup, or from datasource editor), and all of my columns (a subset of them had been missing) were reloaded correctly. Once that was done, my inspection was happy and build worked fine.

0
Comment actions Permalink

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/5254931#5254931

0

Please sign in to leave a comment.