I think there might be a problem with the cache in Netbeans, which is causing a problem in creating a new Entity Classes from Database...
.
Netbeans error:
clients cannot be added because it is already mapped to the net.bounceme.dur.jpa.Client entity class and the entity is not in current project source.
Note that this is using the resource jdbc/ejb
.
the persistence.xml
generated by the IDE:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="A-ejbPU" transaction-type="JTA">
<jta-data-source>jdbc/ejb</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.schema-generation.database.action" value="create"/>
</properties>
</persistence-unit>
</persistence>
and the related glassfish-resources.xml
, also generated by the IDE:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="mysql_legacy_jdbcPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<property name="serverName" value="localhost"/>
<property name="portNumber" value="3306"/>
<property name="databaseName" value="legacy"/>
<property name="User" value="jdbc"/>
<property name="Password" value="password"/>
<property name="URL" value="jdbc:mysql://localhost:3306/legacy?zeroDateTimeBehavior=convertToNull"/>
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="jdbc/ejb" object-type="user" pool-name="mysql_legacy_jdbcPool"/>
</resources>
A different resource, on the glassfish server, might not be directly related:
thufir@dur:~/NetBeansProjects$
thufir@dur:~/NetBeansProjects$ /home/thufir/glassfish-4.1/glassfish/bin/asadmin
Use "exit" to exit and "help" for online help.
asadmin>
asadmin> list-jdbc-connection-pools
CLI031: Warning: Option "target" is obsolete and will be ignored.
CLI031: Warning: Option "target" is obsolete and will be ignored.
__TimerPool
DerbyPool
SamplePool
connectionPool
legacy_on_glassfish
Command list-jdbc-connection-pools executed successfully.
asadmin>
asadmin> ping-connection-pool legacy_on_glassfish
Command ping-connection-pool executed successfully.
asadmin>
asadmin> list-jdbc-resources
jdbc/sample
jdbc/__TimerPool
jdbc/__default
jdbc/local
jdbc/legacy_resource
Command list-jdbc-resources executed successfully.
asadmin>
asadmin> exit
Command multimode executed successfully.
thufir@dur:~/NetBeansProjects$
although I think those resources on the glassfish server are unrelated, but there might be some interplay.
I've looked in:
thufir@dur:~$
thufir@dur:~$ ls /home/thufir/.netbeans
8.0.1
thufir@dur:~$
thufir@dur:~$ ls /home/thufir/netbeans-8.0.1/
apisupport etc java nb README.html websvccommon
bin extide javafx netbeans.css THIRDPARTYLICENSE.txt
CREDITS.html harness LICENSE.txt platform uninstall.sh
enterprise ide moduleCluster.properties profiler webcommon
thufir@dur:~$
see also:
http://pietervogelaar.nl/ubuntu-11-04-netbeans-7-clear-cache
perhaps I'm just not seeing the cache, assuming that's the problem?