java - Parameterization entity with JPA -
I am trying to create a unit to parameter the values of business rules, I have name, type and value
Value:
Value:
Type: value (double)
Value: 20
Usage will be done in a rule to add 20% of the value of the imported product. But I have many situations in the form of string, boolean or multi-valuable I thought of something like this:
@NotEmpty private string name; // Enum @Enumerated (EnumType.STRING) @Enumeration (enumClass = ParameterType.class) with possible type (text, value, boolean, etc.) Private parameter type type; @OneToMany (mapped = "value") private list & lt; Parameter Value & gt; Values;
ParameterValue unit, how can I implement it, because the value can be of different types (double, string, boolean, etc.)?
This does not work:
public class parameter value {Private object value; }
Reason: org.hibernate.MappingException: Number of columns in property mapping is incorrect: br.entity.admin.ParameterValue.value Type: Object "}}
< / Div>
This depends on your columns in the database. For example, if you type in enum
MySQL uses
. It can be:
@Enumerated (EnumType.STRING) Private parameter type type;
Where parameter value
public enum parameter value {tex} T, value, Boolean}
Comments
Post a Comment