6819 Hibernate integration not working - errors in hbm.xml files
Hi I have just tried to set up IDEA 7.0M1 to work with Hibernate on Oracle database.
Now in all my hbm.xml files it highlights table and column names as invalid definitions.
See attachment.
I was trying to fix it by specifying schema name and uppercasing everything in hbm.xml but it still does not work. (BTW, if it worked I hope that I would not need to change my code by adding schema and uppercasing everything).
Nothing is suggested when I press alt+space on the table="" definition.
Attachment(s):
idea7_hibernate.png
Please sign in to leave a comment.
Hello Adam,
Have you tried specifying DataSource for you session factory
(by editing hibernate facet properties or by means of quickfix)
Gregory Shrago
Adam wrote:
Hi Gregory.
Yes, I have bound the Data Source created in Tools menu with the Session Factory in Project Structure, Hibernate Facet.
Is there any other information I could provide?
Attachment(s):
Facet.png
Ok, now I have
- stopped idea 7
- opened my project in idea 6
- closed idea 6
- opened idea 7, had to kill the process because it hung
- opened idea 7 succesfully
- reconfigured hibernate facet, because the settings got lost
and IT WORKS!
However there are three issues:
1. the names of columns and tables suggested by alt space are always upper case. We started coding with lower case and I would not like to change it. I think when configuring Data Source it would be nice to be able to specify what should be the case.
validation issues: see following code
]]>
2. lazy="extra" is highlighted red, event though extra is in the list of allowed and suggested by alt+space values.
3. cascade="all-delete-orphan" is highlighted red but this setting is actually allowed see
http://forum.hibernate.org/viewtopic.php?t=938758&sid=b70b50613458c8e0c89dde31e9012447
(Of course hibernate should just have decent DTD instead of what they give, it is still nice that you try to help developers with it)
Hello Adam,
If you have some minutes to spare, you can submit enhancement requests and
bugs yourself to the JetBrains JIRA:
http://www.jetbrains.net/jira/secure/BrowseProjects.jspa
("Create new issue"->Project: "Idea Feedback"->Component: "J2EE.Hibernate")
The benefits are:
-you can 'watch' issues: get notified when something happens with it
-other users can vote and comment
This would be nice to have indeed, good idea!
Regards,
-tt
- stopped idea 7
- opened my project in idea 6
- closed idea 6
- opened idea 7, had to kill the process because it hung
- opened idea 7 succesfully
- reconfigured hibernate facet, because the settings got lost
The above steps did not work for me. All my table names and column names are red even though they are valid.
I also have all-delete-orphan which is red but valid.
(build 6819)
Adam, I think you should add this mapping xml file to hibernate.cfg.xml because IDEA does not know the sessionfactory name for the mapping file if it has not beed added in hibernate.cfg.xml file.
Please add the following sentence to your hibernate.cfg.xml and try. I got the same problem if I don't add mapping file declaration to hibernate.cfg.xml file.
]]>
Hi linux_china,
Your suggestion might help but as I have written - it started working for me even if my mappings *.cfg.xml files are not listed in hibernate.cfg.xml.
IDEA was able to pick up my mappings somehow automagically.
I remember I have added name to my <session-factory> in hibernate.cfg.xml, then after restarting Idea and reconfiguring Hibernate I had two session factories and then it started to work.
Funny thing I have removed the name later on, but it still works well.
See attachment.
Attachment(s):
hibernate_facet.png
Hello Adam,
Adam wrote:
> We started coding with lower case and I would not like to change it.
>I think when configuring Data Source it would be nice to be able to
specify what should be the case.
Will be fixed shortly - prefix will determine the case of inserted text.
At the moment suggested table/column names are provided exactly as they
are returned by JDBC.
Fixed.
Fixed.
Regards,
Gregory Shrago