jpa - EclipseLink does not work on Netbeans, is this normal? -


it'll weeks i'm stuck eclipselink. can not persist object in database. use netbeans 7.3. encountered problem when started designing web application. follows approach have adopted. may without me realize mistake.

after netbeans has finished generating project files configured jndi. converted automatically netbeans, database tables in entity object. here link

then, these classes, created jpacontroller . (always automatically netbeans)

and finally, test, instantiate description of "outils" , leave fields empty id. since latter automatically increment in database, if persistence done well, should have id when appear out console.

<body>     <h1>hello world!</h1>     <%        outils o = new outils();        o.setdesignation("hammers");         entitymanagerfactory emf = persistence.createentitymanagerfactory("test_eclipselinkpu");        usertransaction utx = (usertransaction) new initialcontext().lookup("java:comp/usertransaction");         outilsjpacontroller o_ctrl = new outilsjpacontroller(utx, emf);        o_ctrl.create(o);         out.println("this id of hammer " + o.tostring());     %> </body> 

and result: outils[ id=null ].

i have no error or on glassfish less debugger.

ps : here persistence.xml file

<?xml version="1.0" encoding="utf-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">     <persistence-unit name="test_eclipselinkpu" transaction-type="jta">         <jta-data-source>test_data_source</jta-data-source>         <exclude-unlisted-classes>false</exclude-unlisted-classes>         <properties/>     </persistence-unit> </persistence> 

thank future in answers , listening additional information.

(not answer couldn't show in comment) increase logging persistence.xml should this:

<?xml version="1.0" encoding="utf-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">     <persistence-unit name="test_eclipselinkpu" transaction-type="jta">         <jta-data-source>test_data_source</jta-data-source>         <exclude-unlisted-classes>false</exclude-unlisted-classes>         <properties>             <property name="eclipselink.logging.level" value="fine"/>             <property name="eclipselink.logging.level.sql" value="fine"/>             <property name="eclipselink.logging.parameters" value="true"/>         </properties>     </persistence-unit> </persistence> 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -