Why "New > Entity Bean" contextual menu is not available?

Use Case:
0) IDEA version 8.1 (Build #9732)
1) I have a datasource configured. Associated tables properly show up in the 'Data Sources' frame.
2) I create a new module with 'Enterprise JavaBeans 3.0 without ejb-jar.xml' and 'JavaEE Persistence 1.0 with TopLink' technologies. I don't check the 'Import database schema' (Let's assume my database schema is not yet finished when I create the module)
3) In the project View (same thing in the Java EE view), when I right click on the module source folder, select 'New', the only Bean templates that are available are 'Session Bean' and 'Message Bean'. Why is there no entry for 'Entity Bean'?  I would like a such entry, and then get a wizard similar to what I would have got if I had choosen above 'Import database schema'.

Same kind of question, if my Entity Beans have bean generated by checking the 'Import database schema' when creating my module, and that I then later update my database schema (new tables, new columns...). How do I propagate the changes to my project?

Thanks for any help or tip!

2 comments
Comment actions Permalink

S. G. wrote:

Use Case: 0) IDEA version 8.1 (Build #9732) 1) I have a datasource
configured. Associated tables properly show up in the 'Data Sources'
frame. 2) I create a new module with 'Enterprise JavaBeans 3.0
without ejb-jar.xml' and 'JavaEE Persistence 1.0 with TopLink'
technologies. I don't check the 'Import database schema' (Let's
assume my database schema is not yet finished when I create the
module) 3) In the project View (same thing in the Java EE view), when
I right click on the module source folder, select 'New', the only
Bean templates that are available are 'Session Bean' and 'Message
Bean'. Why is there no entry for 'Entity Bean'? I would like a
such entry, and then get a wizard simila r to what I would have got
if I had choosen above 'Import database schema'.


New->Entity is available on JPA/Hibernate facet nodes in
JavaEE:Structure view.

There is an option new Entity Bean on EJB facet with ejb-jar.xml
that creates new CMP/BMP Entity (EJB 2.1 spec and earlier) which is not
a JPA entity.

Actually if your ORM metadata specified in terms of java annotations
then JPA entity is a simple Java class with @Entity annotation that can
be created simply by New->Class.


Same kind of question, if my Entity Beans have bean generated by
checking the 'Import database schema' when creating my module, and
that I then later update my database schema (new tables, new
columns...). How do I propagate the changes to my project?


You can reimport schema on existing sources and missing code will be
generated.

Regards,
Gregory Shrago

0
Comment actions Permalink

Thanks. Perhaps that IntelliJ help on this topic could be improved...
I just put here the exact procedure for reference for other users:
1) Switch to 'Java EE: Structure' view
2) In the project window, right click on a configured persistence unit and choose 'New > Entity' (The menu is not available in the 'Project' view like for all other types of beans...)
3) In the project window, right click on the newly created entity bean to add new persistence fields. (The menu is not available when right clicking in the code area, or when using the generate command (Alt+Insert)...)
4) And/Or, right click on the persistence unit and choose 'Generate Persistence Mapping > By Database schema' to generate/update Enties from a database

0

Please sign in to leave a comment.