Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » how to create tables using persistence.xml (glassfish, oracle xe)
how to create tables using persistence.xml (glassfish, oracle xe) [message #434639] Fri, 07 March 2008 12:18 Go to next message
Eclipse UserFriend
Originally posted by: mateusz.blaz.e-surf.pl

Hi!

I'm quite new to Eclipse in JEE applications, but I've been using Netbeans
for some time. My problem is that I can't make Eclipse create tables
depending on my entities. I would like to have creating database schema
automated as it was in Netbeans. It seems to me, that it's possible in
Eclipse with Dali too.

I'm using Oracle 10g XE and the newest Eclipse Europe. My application server
is Glassfish v2.

I have created and tested connection pool and JDBS resource in glassfish.
There is one enabled on JNDI adress: "TEST".

In Elipse I have defined the connetion. I have tested it using ping. In Data
Source Explorer I can view database elements.

I am using JPA implementation provided by server and the generic platform.

I have created such a persistence.xml file:
<?xml version="1.0" encoding="UTF-8"?>

<persistence version="1.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_1_0.xsd">

<persistence-unit name="TEST" transaction-type="JTA">

<jta-data-source>TEST</jta-data-source>

<class>test.ejb.JPATest</class>

<properties>

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

<property name="toplink.logging.level" value="ALL"/>


</properties>

</persistence-unit>

</persistence>


My test.ejb.JPATest java class looks like this:

import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class JPATest {

@Id
Long id;

}

In the problems box i can see errors:
table JPATest doesn't exist
collumn Id doesn't exist

I have tried running my module on server, publishing it, restarting the
server in order to create this table on my database, but it didn't work..
There are no exceptions in Glassfish logs, I couldn't find any error in
Eclipse log either. It seems just like properties in persistence.xml were
ignored.

I cannot use Generate DDL as I'm using generic platform.

Can you help me please and give any suggestions, what am I doing wrong? Is
there any way I have to force interpreting the persistence.xml configuration
during deploy?

Thanks a lot for any help!

Sorry for my english.

Best wishes

Mateusz B
Re: how to create tables using persistence.xml (glassfish, oracle xe) [message #434640 is a reply to message #434639] Sat, 08 March 2008 23:13 Go to previous message
Shaun Smith is currently offline Shaun SmithFriend
Messages: 197
Registered: July 2009
Senior Member
If you want TopLink Essentials to generate database tables inside
Glassfish, or any other Java EE 5 container, you need to specify one more
property.

<property name="toplink.ddl-generation.output-mode" value="database"/>

In container, TopLink Essentials defaults to generating a SQL script. In
Java SE it defaults to generating both a SQL script and sending DDL to the
datbase.

TopLink Essentials Schema Generation options are documented here:
http://www.oracle.com/technology/products/ias/toplink/JPA/es sentials/toplink-jpa-extensions.html#Java2DBSchemaGen

BTW, DLL generation is supported in Dali through the Platform, but the
Generic platform shipped with Dali 1.0 does not implement it. For Dali
2.0 we will be providing an EclipseLink platform which will use the
EclipseLink runtime to generate DDL.

--Shaun
Re: how to create tables using persistence.xml (glassfish, oracle xe) [message #607415 is a reply to message #434639] Sat, 08 March 2008 23:13 Go to previous message
Shaun Smith is currently offline Shaun SmithFriend
Messages: 197
Registered: July 2009
Senior Member
If you want TopLink Essentials to generate database tables inside
Glassfish, or any other Java EE 5 container, you need to specify one more
property.

<property name="toplink.ddl-generation.output-mode" value="database"/>

In container, TopLink Essentials defaults to generating a SQL script. In
Java SE it defaults to generating both a SQL script and sending DDL to the
datbase.

TopLink Essentials Schema Generation options are documented here:
http://www.oracle.com/technology/products/ias/toplink/JPA/es sentials/toplink-jpa-extensions.html#Java2DBSchemaGen

BTW, DLL generation is supported in Dali through the Platform, but the
Generic platform shipped with Dali 1.0 does not implement it. For Dali
2.0 we will be providing an EclipseLink platform which will use the
EclipseLink runtime to generate DDL.

--Shaun
Previous Topic:Microsoft Sql Server 2005 datatype mapping issues
Next Topic:Generate Entities Problem w/ MySQL
Goto Forum:
  


Current Time: Fri Mar 29 13:35:18 GMT 2024

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

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

Back to the top