aj_us
aj_us

Reputation: 119

Creating DB table through Entity Bean

I am working on EJB3. Is it possibe to create Oracle DB table at run time through Entity Bean?

For this i have created a entity bean and i have made entry for this bean to persistence.xml also. I thought it will create DB table at run time. But table was not created.

Is it possible to create table at run time through entity bean. If yes what i am doing wrong.

Thankx in advance for your time and help

Upvotes: 1

Views: 1482

Answers (1)

Nayan Wadekar
Nayan Wadekar

Reputation: 11622

You can configure entity generation in your persistence.xml, sample is shown below.

Make changes according to your environment.

<property name="toplink.ddl-generation" 
          value="drop-and-create-tables"/>
    <!-- Generating derby specific sql -->
<property name="toplink.platform.class.name"
          value="oracle.toplink.essentials.platform.database.DerbyPlatform"/>

Also if you are using EJB-3.x, no need to make entry of entity beans in persistence.xml, use annotations instead.

Upvotes: 2

Related Questions