lundi 20 avril 2015

How to customize the Mapping of a column of an Entity with DbUnit 2.4.8

Vote count: 0

In my project, to make tests, DbUnit 2.4.8 and org.unitils 3.3 are used with openjpa 1.2.2

When i want to execute test, i have a problem for the creation of one table. This is the error i receive :

org.unitils.core.UnitilsException: Error inserting test data from DbUnit dataset for method public void be.fed.minfin.adminctx.backend.dao.impl.HistMouvementDAOTest.testMoveStepAndPhaseForward() at org.unitils.dbunit.DbUnitModule.insertDataSet(DbUnitModule.java:156) at ...................... Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is org.apache.openjpa.persistence.PersistenceException: unexpected token: ORDER {stmnt 17691874 CREATE TABLE CatDocumentTypeModeleLabelLevel (Langue VARCHAR(255) NOT NULL, SIDCatDocumentTypeModeleLevel INTEGER NOT NULL, Label VARCHAR(255), Level INTEGER, Order INTEGER, Phase INTEGER, Visible BIT, PRIMARY KEY (Langue, SIDCatDocumentTypeModeleLevel))} [code=-5581, state=42581] at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:375) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:377)

Actually, there is a table created with a column named "order" (represented by the Entity "Niveau") . And I have to use this (it is not me that has created this table).

In the persistence-test.xml, i use the property ; openjpa.jdbc.SynchronizeMappings with the value buildSchema(ForeignKeys=true) to make automatically the mapping with the Entities.

And i declare also, all the classes (entities) that are used in the tests.

For only one Entity, i would like to configure the name of the column "order", to change it in another name... And for the other entities, i would like to keep that automatic mapping (for the metadata's).

So my question, is how could i do that ?

asked 2 mins ago



How to customize the Mapping of a column of an Entity with DbUnit 2.4.8

Aucun commentaire:

Enregistrer un commentaire