Home » Support » Forum » @Column( name = "columnName") doesn't work

@Column( name = "columnName") doesn't work

#1

I have created following entity class with custom fields

@Entity
public class AfwDataKey
{
   @Id
   @GeneratedValue
   @Column(name = "KEY_ID")
   private long id;
   private Long timestamp;

   @ManyToOne
   @Column(name = "KEY_DESCRIPTOR")
   private AfwKeyDescriptor keyDescriptor;

   @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
   @Column( name = "DATA_ITEMS" )
   private List<AfwDataKeyItem> dataItems;

   @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
   private AfwCodedDataBlock codedDataBlock;

   private int level;

.....

}

And expected that after import data to DB, fields must be with following names:

KEY_ID,
timestamp,
KEY_DESCRIPTOR,
DATA_ITEMS,
codedDataBlock,
level

but them still not correctly mapped and stays like member defined in class

id,
timestamp,
keyDescriptor,
dataItems,
codedDataBlock,
level

I have used the 2.5.1 & the latest 2.5.5 objectDb version and both of them work the same. Could you explain how can I fix this problem?

Symphony Teleca (Harman)
#2

ORM/SQL annotations are silently ignored by ObjectDB (as indicated for example on the Column annotation doc pagejavax.persistence.ColumnJPA annotationIs used to specify the mapped column for a persistent property or field.See JavaDoc Reference Page...).

When you use ObjectDB, you only have the names of the fields in your Java classes, with no mapping.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login