Question about Hibernate facet
Hi all,
I have a small project with some Hibernate and Spring dependencies. Therefore, I also added the Hibernate and Spring facet. They seem to be working okay, but when I go the J2EE perspective, and select my sessionFactory, there are no Hibernate mappings, even though they are configured (they are configured in the applicationContext.xml). Also, when I open the ER model, I see no entities, nor does adding them do any good (nothing happens).
What could I have missed, or how can I fix this? Any help greatly appreciated!
Erik
Please sign in to leave a comment.
ps: these are my Spring configurations (and web.xml)
Attachment(s):
applicationContext.xml
cookbook-servlet.xml
web.xml
Hello Erik,
Can it be this one: http://www.jetbrains.net/jira/browse/IDEADEV-17217 ?
Alexander.
Actually, I just created an issue for it myself:
http://www.jetbrains.net/jira/secure/ManageAttachments!default.jspa?id=150713
I'll check if the classpath prefix works.
You're right, it's exactly the same behaviour. I've added the classpath prefix, and now IntelliJ does find them. However, the poster of the comment in issue IDEADEV-17217 is also right: now, the application doesn't work anymore, failing with a FileNotFoundException:
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource : Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource : Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource cannot be opened because it does not exist
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource : Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource cannot be opened because it does not exist
Caused by: java.io.FileNotFoundException: class path resource cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:135)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:656)
Try using the "mappingLocations" property of LocalSessionFactoryBean. IDEA
does not fully support "mappingResources" yet.
In addition, when your SessionFactory is configured using spring you won't
need a hibernate.cfg.xml.
Taras
Hi Taras,
Thanks for the answer. I tried your approach, and it seems to be working. I'd still like this bug/feature to be implented though, but this is also workable!
Thanks!