|Re: [eclipselink-users] Problem creating tables|
One way to verify is to try to change your strategy to GenerationType.IDENTITY and remove the generator.
@GeneratedValue(strategy=GenerationType.IDENTITY) Does that make your application behave as it did before? -Tom Ellen Kraffmiller wrote:
We are using annotations - here is an example:@Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="study_gen")@SequenceGenerator(name="study_gen", sequenceName="study_id_seq") private Long id;Hi Ellen,Could you post the annotations and/or xml you are using to define the sequence causing the issue?Thanks, Tom Ellen Kraffmiller wrote:Hi Tom, I added the property and the tables are being generated now, thanks.Two difference I noticed between TopLink Essentials DDL and EclipseLink DDL (and target database of Postgres): 1) The primary key in TopLink DDL is type serial; in EclipseLink it's type int8. 2) The sequences generated with TopLink have increment value of 1, in EclipseLink it's 50. The first difference is causing a problem because we have a sql script for setting reference data that contains insert statements, which don't call nextval() to set the primary key. I can change the script, but I just was curious if there's a property I can use to tell EclipseLink to use type serial.The second difference I think is causing a problem when I run the application with EclipseLink, but keep the sequences originally generated by TopLink (something we will need to do if we switch to EclipseLink in production). When I try to persist a new entity I get this Exception - The sequence named [study_id_seq] is setup incorrectly. Its increment does not match its pre-allocation size. at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:191) at com.sun.enterprise.util.EntityManagerWrapper.persist(EntityManagerWrapper.java:440)Any suggestions for workarounds for this error? Thanks, Ellen Tom Ware wrote:Hi Ellen, What happens when you add the following property?<property name="eclipselink.ddl-generation.output-mode" value="database"/>-Tom Ellen Kraffmiller wrote:Hi Tom,I am using EclipseLink DDL generation, here is the persistence unit metadata:<persistence-unit name="VDCNet-ejbPU" transaction-type="JTA"><provider>org.eclipse.persistence.jpa.PersistenceProvider</provider><jta-data-source>jdbc/VDCNetDS</jta-data-source> <properties> <property name="eclipselink.logging.level" value="FINEST"/><property name="eclipselink.ddl-generation" value="create-tables"/></properties> </persistence-unit> Thanks, Ellen Tom Ware wrote:Hi Ellen,Are you using the DDL generation feature of EclipseLink? If so, can you forward the persistence unit properties you are using to enable it? If not, how are you generating your tables.I suspect the problem is related to the way GlassFish does table generation. It expects EclipseLink to provide some files it can use to add and drop tables. I am wondering if it is having trouble finding them because of an integration issue.-Tom Ellen Kraffmiller wrote:I am able to use the nightly build in Glassfish, and the persistence unit deploys correctly, as long as my tables already exist. However I'm running into a problem when I drop my tables and redeploy the application - no tables are created in the database. I'm not seeing any error messages in my server log, but I noticed the nightly build had some test failures relating to create table. Could the failures in the nightly build be related to the problem I'm seeing?Thanks, Ellen _______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users_______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users_______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users_______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users
Back to the top