Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Customizing schema generation
Customizing schema generation [message #1066094] Sun, 30 June 2013 06:30 Go to next message
dan pomerchik is currently offline dan pomerchik
Messages: 5
Registered: June 2013
Junior Member
hi,
I need to modify the tables created by eclipselink. We have a custom CVS system we implemented, which requires some additional columns for each table (which we dont want to be a part of the entity. that is, its only in the database, not in the java class - like DTYPE for example. we have some stored procedures and views that regard those columns). anyway, currently we do it by letting EL create the database and afterwards we run a PLSQL script to change the names of the tables, add columns and create views..
I want to replace this script by integrating somehow into EL schema generation. The easiest point i found to do it, is by using the SessionEvent listener. Using preLogin event i have the session/project and i can modify it. The problem is that i succeeded adding a field to the 'main' table, but when i try adding to the collection table, i get for some reason, except for my added column, an objId field (its my primary key of the 'main' table). Attached my code (its screenshot because my work doesn't allow posting code.. :/) I hope you understand my question..
Thanks.,
Re: Customizing schema generation [message #1066638 is a reply to message #1066094] Wed, 03 July 2013 10:16 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You cannot add the table to the descriptor, this will make it thinks it maps to the table.

Using your script is probably the best solution, you may want to use the new script features of JPA 2.1 (EclipseLink 2.5).

http://wiki.eclipse.org/EclipseLink/Release/2.5/JPA21#DDL_generation

EclipseLink using the DefaultTableGenerator to generate the DDL, you may also consider using this directly, or subclassing it to have more control of DDL generation.



James : Wiki : Book : Blog : Twitter
Re: Customizing schema generation [message #1067192 is a reply to message #1066638] Sun, 07 July 2013 08:53 Go to previous message
dan pomerchik is currently offline dan pomerchik
Messages: 5
Registered: June 2013
Junior Member
So it isn't possible doing it that way? it almost works... the only problem it's that for the collection table it adds another field...

What do you mean new script features? i took a look on that wiki and didn't quite got it.
Previous Topic:Customizing schema generation
Next Topic:Not able to get the inserted Entity after Query.getSingleResult(INSERT INTO..... VALUES......)
Goto Forum:
  


Current Time: Mon Jul 28 00:14:08 EDT 2014

Powered by FUDForum. Page generated in 0.02286 seconds