1 Reply Latest reply: May 27, 2014 7:37 AM by cdelahun RSS

    How to persist more than one table in jpa project without row value setting to null for the existing table .

    930990

      Every time the new plain java [ in the same package containing other pojo classes ] class is created, i persist the tables into database using eclipse GENERATE TABLES USING ENTITIES and it happens with the cost of deleting the existing values table rows.

      Below is the persistance.xml code

      --------------------------------------------------------------------

      <?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="JpaSeries" transaction-type="RESOURCE_LOCAL">

        <class>pojo.HelloWorld</class>

        <class>pojo.FindUpdateDelete</class>

        <properties>

        <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/tempo"/>

        <property name="javax.persistence.jdbc.user" value="root"/>

        <property name="javax.persistence.jdbc.password" value="newyp@1988"/>

        <property name="eclipselink.ddl-generation" value="create-tables"/>

       

       

        </properties>

        </persistence-unit>

      </persistence>

      ---------------------------------------------------------------------------------------

       

      Below is the project structure--image link

       

      https://www.dropbox.com/s/j9aumy0u02r427v/Capture.PNG

       

      Thanks

      Prashanth