Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » How to create DB2 tables from entitys
How to create DB2 tables from entitys [message #1746279] Wed, 26 October 2016 12:07 Go to next message
Matias Panasci is currently offline Matias PanasciFriend
Messages: 7
Registered: March 2015
Junior Member
Hello I'm trying to create tables in DB2 from the entities that I have in my project, but I can not and do not see error messages in the log.

I am using tomcat 7 and this is my persist.xml

<?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="GestionArchivoPU" transaction-type="JTA">
        <jta-data-source>dbGestionArchivo</jta-data-source>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <properties>
            <property name="javax.persistence.schema-generation.database.action" value="create"/>
            <property name="javax.persistence.jdbc.driver" value="com.ibm.db2.jcc.DB2Driver" />
            <property name="javax.persistence.jdbc.url"  value="jdbc:db2:192.168.1.17:50000/GARCHIVO" />
            <property name="javax.persistence.jdbc.user" value="root" />
            <property name="javax.persistence.jdbc.password" value="root" />
            <property name="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)" />
            <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/> 
            <property name="eclipselink.ddl-generation.output-mode" value="both"/> 
            <property name="eclipselink.logging.level" value="FINEST"/>            
        </properties>
    </persistence-unit>
</persistence>


The database connection is made, but doesn't create the tables...

any advice ?
Re: How to create DB2 tables from entitys [message #1746301 is a reply to message #1746279] Wed, 26 October 2016 15:40 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Have you tried executing something in an EntityManager? EclipseLink will lazily deploy the persistence unit by default, so it could be that tables just aren't created yet. You can try changing the lazy deployment so that tables are dropped/created when you obtain an EntityManagerFactory using the eclipselink.deploy-on-startup property:
https://www.eclipse.org/eclipselink/documentation/2.4/jpa/extensions/p_deploy_on_startup.htm

Since you have logging on finest though, does the logging say if it is finding your entities? It can't create tables for entities it can't find.

[Updated on: Wed, 26 October 2016 15:42]

Report message to a moderator

Previous Topic:Moxy - supported xPath version?
Next Topic:Lazy loaded relation after detach with cascade detach not detached.
Goto Forum:
  


Current Time: Tue Mar 19 03:41:34 GMT 2024

Powered by FUDForum. Page generated in 0.02681 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top