Code inspector marking error incorrectly due to hibernate mapping

Code inspector is marking some getter functions in my hibernate POJOs with errors when I have a bi-directional one-to-one mapping. According to hibernate documentation I'm supposed to have one side with a <many-to-one unique="true"> element and the other side with a <one-to-one> element. But the code inspector says, "'<many-to-one>' attribute has incorrect opposite '<one-to-one>' 'person'". On the opposite side of the one-to-one relationship the error reads, "'<one-to-one>' attribute has incorrect opposite '<many-to-one>' 'user'". Disregarding that code inspection error, the actual code works perfectly.

I could, of course, disable the inspections. But is there a proper way to specify this relationship for IDEA? I really love the code inspections. Is this a bug in IDEA?

4 comments
Comment actions Permalink

I just found out intellij has an HQL console! It sounds amazing, just what I need. Unfortunately the above problem with intellij is preventing me from using it :(. Can someone help me find a workaround? Is this a bug that will be fixed in a future release? Am I missing something?

0
Comment actions Permalink

Hello Scott,

Code inspector is marking some getter functions in my hibernate POJOs
with errors when I have a bi-directional one-to-one mapping.
According to hibernate documentation I'm supposed to have one side
with a <many-to-one unique="true"> element and the other side with a
<one-to-one> element. But the code inspector says, "'<many-to-one>'
attribute has incorrect opposite '<one-to-one>' 'person'". On the
opposite side of the one-to-one relationship the error reads,
"'<one-to-one>' attribute has incorrect opposite '<many-to-one>'
'user'". Disregarding that code inspection error, the actual code
works perfectly.

I could, of course, disable the inspections. But is there a proper
way to specify this relationship for IDEA? I really love the code
inspections. Is this a bug in IDEA?


Looks like a bug. Please file a JIRA issue at http://www.jetbrains.net/jira/

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

What project do I file this issue under? "IDEA: Feedback"? It's a bug report rather than feedback... but I don't see anything else relevant there.

0
Comment actions Permalink

I filed the bug under "IDEA: Feedback," but there are still no responses. Any idea when there will be some kind of patch? Does nobody else use one to one relationships in hibernate?

0

Please sign in to leave a comment.