Defining attribute for a new model using JPA Annotations

Tags: #<Tag:0x00007f7519f34f18> #<Tag:0x00007f7519f34db0>

Hello Everyone,

We are introducing a new attribute in one of our custom models, and we are facing problems with hibernate mappings. We are using Hibernate Annotations instead of .hbm.xml files.

The error is related to the field value defined in BaseAttribute.java. We keep getting below error:

org.hibernate.MappingException: property mapping has wrong number of columns: org.openmrs.module.icrc.assignedAction.model.AssignedActionAttribute.value type: object

This field is defined as below:

private transient Object value;

This gets ignored in hbm.xml files when we don’t add a mapping for this field. Refernce: VisitAttribute.hbm,xml

But we are not able to do the same using JPA Annotations. We have tried below things:

Any idea what might be causing this problem. It will be better if we can find out an Attribute which is defined using JPA Annotations.

@dkayiwa @mksd @wyclif @rrameshbtech @premnisha @sukreet @rmkanda

Is your code available for us to try reproduce locally?

Hello @dkayiwa,

Not the one which we have been using. I will try to create a sample project where I can reproduce it and send you guys the link.