This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 225617 - Add support for standalone persistence.xml in Java EE 6 projects
Summary: Add support for standalone persistence.xml in Java EE 6 projects
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 7.3
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-01 01:42 UTC by abien
Modified: 2016-07-07 08:56 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
IDE log (69.28 KB, text/plain)
2013-02-01 01:42 UTC, abien
Details

Note You need to log in before you can comment on or make changes to this bug.
Description abien 2013-02-01 01:42:43 UTC
Product Version = NetBeans IDE 7.3 RC1 (Build 201301240957)
Operating System = Mac OS X version 10.8.2 running on x86_64
Java; VM; Vendor = 1.7.0_12-ea
Runtime = Java HotSpot(TM) 64-Bit Server VM 24.0-b28

Only the generation of Java EE persistence.xml descriptors for a WAR / EJB project is supported by NetBeans 7+.

However, for integration testing, a persistence.xml pointing to a local, embedded DB is needed:

<persistence>
  <persistence-unit name="integration" transaction-type="RESOURCE_LOCAL">
    <class>...AnEntity</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties>
      <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:testDB;create=true"/>
      <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
      <property name="eclipselink.ddl-generation" value="create-tables"/>
    </properties>
  </persistence-unit>
</persistence>

Such a persistence.xml usually resides in src/test/resources/META-INF

Currently you can only create such a persistence.xml by creating a Java SE project, creating the persistence.xml and copying it into the existing WAR / EJB project.

A direct support for generation or additional persistence.xml for integration test purposes in maven / WAR projects would be nice.
Comment 1 abien 2013-02-01 01:42:53 UTC
Created attachment 130914 [details]
IDE log
Comment 2 Sergey Petrov 2013-09-23 14:56:01 UTC
Are there be any issues with annotation processor with 2 persistence.xml? 
If there are no issues from second persistence.xml usage,  it may have sense to try to add source root selection in persistence unit wizard with cnange of datasources to jdbc resources in case of tests selection. 
Need to check/review how visual designer will handle these two persistence xml.

Other possible places to review - 
By default entities from db do not allow to configure pu created and it may remain with old behavior, it's a question what to do with "missed pu" hint, and with pu configuration in new|entity wizard and a few more wizards with ability to create pu.

Will it be enough to add an option in new pu wizard only?
Comment 3 Petr Jiricka 2013-09-23 20:08:24 UTC
> it may have sense to try to add source root selection in persistence 
> unit wizard with cnange of datasources to jdbc resources in case 
> of tests selection. 

I agree, I would hope this is the main change needed in the UI. I agree there are difficulties that would need to be handled.

> Will it be enough to add an option in new pu wizard only?

I think so, but I'll let Adam comment as well.
Comment 4 Martin Balin 2016-07-07 08:56:45 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss