简体   繁体   中英

IntelliJ IDEA with hibernate support

I have IntelliJ IDEA 8.1.3.

It has support for a hibernate facet/plugin which I have enabled. When I do this it recognises the HQL query strings but highlights in red all the objects and properties. I can't see how to get IDEA to be aware of my entities.

I use spring+hibernate and annotated objects. I have no hibernate.cfg.xml just a spring bean using AnnotationSessionFactoryBean .

Does anyone know how I can get this to work? Does the standard IntelliJ support this?

You simply need to configure the datasource for your application. Usually to get this done you can directly access the auto-correction menu ( alt + enter ) and it will ask you to associate a datasource to your hibernate facet.

I do the same in that I use a number of datasources, however, IntelliJ just wants to be able to locate the table names and columns so that it can autocomplete and lookup correctly.

I presume that the table and column names are the same between data sources. If they are, then all I do is use the SQL create scripts (which I exported from one of he databases) to create DDL datasource inside the Datasources menu.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM