Warnings about valid Hibernate extensions to standard JPA mappings
We use Hibernate as the provider of our JPA functionality.
But we also use the extra functionality that Hibernate provides above and beyond the spec.
At the moment, IDEA is reporting some Persistence Model warnings related to this functionality.
Is there any way to get IDEA to stop complaining when we use these extra features, but still do basic model validation?
-
The warning that IDEA complains about, but which is valid under Hibernate:
- '@javax.persistence.ManyToOne' attribute cannot be used in Embeddable object
This is allowed under Hibernate, just not by the JPA spec.
-
Another problem is with the following warning:
- '@org.hibernate.annotations.CollectionOfElements' attribute type should be an Embeddable
The element type of the collection property is actually declared embaddable, I'm not sure why IDEA is saying it's not.
-
The warnings both come from the inspection: Inspections\Java EE Issues\Persistence Model Errors
It would be nice if this inspection was a bit more configurable (like the "Declaration has Javadoc problems" inspection which is fully customizable).
Please sign in to leave a comment.
If you add a hibernate facet in addition to the JPA facet, then Idea understands hibernate extensions as well.
(Though there might still be some bugs there.)
Shorn Tolley wrote:
That doesn't seem to help.
Also, why would that be necessary given that the JPA facet has the "Default JPA provider" property (which I have set to "Hibernate")? IDEA already knows I'm using Hibernate via that property, so what would it need the Hibernate Facet for. Also note that the Hibernate facet can't be set up correctly because I don't have a hibernate.cfg.xml file to configure it with (I'm using persistence.xml).
In any case, it doesn't make a difference, the persistence model warnings still clutter up my messages window.
Edited by: Shorn Tolley on Apr 16, 2008 10:36 AM
When will this bug be fixed?
Edited by: Gerson K. M. on Nov 6, 2008 8:02 PM
+1
We're using Hibernate Annotations as well. Since IDEA doesn't consider these when building its internal persistent entity model, we end up with an incomplete/broken model.
Here are my favorite bugs:
Resolve "appliesTo" attribute of "org.hibernate.annotations.Table" annotation
Resolve "columnNames" parameter of "org.hibernate.annotations.Index" annotation
Completion and resolving missing for org.hibernate.annotations.Type annotation