Creating DB table through Entity Bean
I am working on EJB3. Is it possibe to create Oracle DB table at run time through Entity Bea开发者_如何学Cn?
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
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.
精彩评论