We've solved this, the problem was that I have missed table element in my orm.xml, at least this is the only reasonable difference I can point between two:
=== not overriding orm.xml === <orm:entity-mappings version="1.0" xmlns:orm=" http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"> <orm:description> An attempt to override annotations for OpenJPA annotations for org.intalio.tempo.workflow.task.Task to avoid column name "tid". </orm:description> <orm:entity class="org.intalio.tempo.workflow.task.Task" > <orm:attributes> <orm:basic name="ID"> <orm:column name="itd"/> </orm:basic> </orm:attributes> </orm:entity> </orm:entity-mappings> ======================================== ==== the right one =============== <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/ormorm_1_0.xsd" version="1.0"> <description> An attempt to override annotations for OpenJPA annotations for org.intalio.tempo.workflow.task.Task to avoid column name "tid". </description> <entity class="org.intalio.tempo.workflow.task.Task" > <table name="tempo_task"/> <attributes> <basic name="_id"> <column name="itd"/> </basic> </attributes> </entity> </entity-mappings> ======================================== Thanks! -Oleg On Thu, Apr 2, 2009 at 5:01 PM, Oleg Zenzin <[email protected]> wrote: > Hello > > I need to use both annotations and orm.xml to sometimes override mapping > defined with annotations in the compiled file. According to manual: > > *Persistence metadata is specified using either the Java 5 annotations > defined in the javax.persistence package, XML mapping files, or a mixture of > both. In the latter case, XML declarations override conflicting annotations. > * > > I have created and attached test case where I use orm.xml to override a > column name: class org.intalio.tempo.workflow.task.Task has field _id > which is mapped to column "TID" by use of annotations. In file orm.xml I map > this same field to column "ITD" and expect OpenJPA to create DB schema > accordingly (openjpa.jdbc.SynchronizeMappings=buildSchema). But my test > shows that it does not happen, i.e. *mapping defined in orm.xml does not > impact or override mapping defined with annotations*. > > Where did I miss something, is this a bug? > > Thank you, > Oleg Zenzin > > ps. please change file extention to "zip". It contains project descriptors > for IntelliJ IDEA, Eclipse and build scripts for > Buildr<http://buildr.apache.org/>and ant. >
