I have an @Entity class in which there is an instance like this
@Column(name="some_column_in_table", precision=3, scale=1)
private BigDecimal someColumnInTable;
How can I get precision of that instance?
http://docs.oracle.com/javaee/5/api/javax/persistence/Column.html If You just want to programatically get the value set in the annotation, You can do it. The retention for Column is set to RUNTIME, so using Reflection it is possible.
Field f = MyClass.class.getDeclaredField("someColumnInTable")) {
Column column = f.getAnnotation(Column.class);
if (column != null){
System.out.println(column.precision());
}
Here are some other examples how to do it: Is it possible to read the value of a annotation in java?