How does" DataSource ORM annotation problems" work

Who can explain to me how does this inspection work. I have entity class with anntotations, generated by IDEA (from the datasource), but this ispections highlights annotation values as incorrect.

null

6 comments

Hello Nikita,

This inspection checks columns & tables names specified in JPA classes
against specified datasource.
In order to do its work this inspection should be configured by "assign
persitence unit datasource" intention that is available in any
highlighted region.

In 6.0.2 (since next EAP) the inspection is auto-configured if JPA
classes are generated from DataSource.

Nikita wrote:

Wha can explain to me how does this inspection work. I have Entity Class with anntotation, generated by IDEA (from datasource), but this ispections highlights it as incorrect.



Gregory Shrago
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"

0

>In order to do its work this inspection should be configured by "assign
persitence unit datasource" intention that is available in any
highlighted region.

I supposed the same. But this intention doesnt work in current EAP.

0

You can get it working manually, create a DS, load all tables into it.

Then in your persistence.xml, add this property:

]]>

This will then get the autocompletion and whatnot working for tables and columns.

It's nice but shame that the property is stored in the persistence.xml rather than the project file. I wonder what the reasoning was for choosing that location instead of idea specific files?

0

>>You can get it working manually, create a DS, load all tables into it

Can you explain this in a little more detail?

0

In the menu, go to tools (I think) then data sources, and set up the data source there. In the properties, click 'load all tables', and then assign the DS to the persistence unit (or just add the line I mentioned to the persistence.xml file).

0

It's nice but shame that the property is stored in
the persistence.xml rather than the project file. I
wonder what the reasoning was for choosing that
location instead of idea specific files?


It seems like in an ideal world, the data sources would be configured and named in the project file, and then the <jta-data-source> and / or <non-jta-data-source> persistence.xml elements could be used to link up to the data sources.

Assuming that the internals emulated something that looked like JNDI, this would let people configure and test their persistence units directly from IntelliJ in something that looked more like the deployed environment.

-Patrick

0

Please sign in to leave a comment.