No code completion in Hibernate

No code completion in Hibernate when using Springs HibernateDaoSupport in intellij 8.0M1. It just says "No suggestion" when hitting ctrl +space in the following code: getHibernateTemplate().find("from ");

The hibernate facet is turned on and the code completion in the hql console works just fine.


It works fine in Intellij 7.0.4

8 comments
Comment actions Permalink

Hello Joakim,

No code completion in Hibernate when using Springs HibernateDaoSupport
in intellij 8.0M1. It just says "No suggestion" when hitting ctrl
+space in the following code: *getHibernateTemplate().find("from
");*

The hibernate facet is turned on and the code completion in the hql
console works just fine.

It works fine in Intellij 7.0.4


In M1 I have tried hibernate.cfg.xml with references to annotated classes,
and spring config with references to hbm.xml mappings. In both cases completion
works Ok.

Does your Java EE structure view show existent entities under hibernate factory
nodes?

Alexander.


0
Comment actions Permalink

Hi


I can see all my entities under the jee structure view.

I can navigate between the hbm-files and the java classes. Not using annotations.

0
Comment actions Permalink

Hello Joakim,

Hi

I can see all my entities under the jee structure view.

I can navigate between the hbm-files and the java classes. Not using
annotations.


Thank you. That's strange. In general, if IDEA knows about any hibernate-mapped
entities (referred from any session factory config), completion should show
them.

You can post here a code frament around getHibernateTemplate().find("from
"); call. (However, if the return type of getHibernateTemplate() is recognized
correctly, there should not be a problem here.)

You also can try to exit, erase IDEA caches and restart.

Alexander.


0
Comment actions Permalink

Did you ever find a solution to this problem? I'm having a similiar problem with IntelliJ 8 and Spring. I created a class called User and when I try to add it as a bean in my spring config file, I get "no suggestions" for code completion.

0
Comment actions Permalink

Hello kembles5,

Did you ever find a solution to this problem?  I'm having a similiar
problem with IntelliJ 8 and Spring.  I created a class called User and
when I try to add it as a bean in my spring config file, I get "no
suggestions" for code completion.


AFAIU, the problem which has started this thread is about completion in java
code, and your one is about completion in Spring config.

Well, I have tried Spring and it's Ok for me. E.g. in bean like:

<bean id="factorySpring1" >
<property name="dataSource" ref="dataSourceDerby"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.DerbyDialect</prop>
</props>
</property>
<property name="annotatedClasses" value="map.ann.Location6"></property>
</bean>


Completion sees my Location6 class. Necessery conditions are:

1. Spring and Hibernate facets are added to the module.
2. Spring config file is added to configuration file set.
3. A library that includes referred classes (AnnotationSessionFactoryBean)
is added to the module dependencies.

Is it the same for you?

Alexander.

0
Comment actions Permalink

Alexander,

Thanks for the response. I must be missing something. I'm very new to intellij, so please excuse my ignorance.

I was following the Spring demo tutorial (http://www.jetbrains.com/idea/training/demos/spring.html) step by step and expected to see my class in the code completion list (just like the demo), but instead I got "no suggestion."

Also, IntelliJ isn't offering code completion on spring annotations. When I type the @ symbol I can only choose from standard java annotations (Deprecated, Override, SuppressWarnings). I expected to see an option for @component.

Any help would be greatly appreciated...

Jeff

0
Comment actions Permalink

I've still got an open JIRA at http://www.jetbrains.net/jira/browse/IDEA-19745, where I get no Hibernate completion in named query XML files. This still happens in the latest EAP release, although maybe it's an unrelated problem.

0
Comment actions Permalink

I was following the Spring demo tutorial
(http://www.jetbrains.com/idea/training/demos/spring.html) step by
step and expected to see my class in the code completion list (just
like the demo), but instead I got "no suggestion."


Please, make sure that Spring facet is added to your module (see Project
structure dialog).

Also, IntelliJ isn't offering code completion on spring annotations.
When I type the @ symbol I can only choose from standard java
annotations (Deprecated, Override, SuppressWarnings). I expected to
see an option for @component.


Make sure you have proper version of Spring jars. E.g. 2.0.3 did not contain
@Component annotation at all, but 2.5.6 does.

Alexander.


0

Please sign in to leave a comment.