Java Code Examples for javax.persistence.Column#scale()

The following examples show how to use javax.persistence.Column#scale() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AccessibleProperty.java    From warpdb with Apache License 2.0 5 votes vote down vote up
private static String getDefaultColumnType(Class<?> type, Column col) {
	String ddl = DEFAULT_COLUMN_TYPES.get(type);
	if (ddl.equals("VARCHAR($1)")) {
		ddl = ddl.replace("$1", String.valueOf(col == null ? 255 : col.length()));
	}
	if (ddl.equals("DECIMAL($1,$2)")) {
		int preci = col == null ? 0 : col.precision();
		int scale = col == null ? 0 : col.scale();
		if (preci == 0) {
			preci = 10; // default DECIMAL precision of MySQL
		}
		ddl = ddl.replace("$1", String.valueOf(preci)).replace("$2", String.valueOf(scale));
	}
	return ddl;
}
 
Example 2
Source File: JPAEdmFacets.java    From olingo-odata2 with Apache License 2.0 4 votes vote down vote up
private static void setScale(final Column column, final SimpleProperty edmProperty) {
  if (column.scale() > 0) {
    ((Facets) edmProperty.getFacets()).setScale(column.scale());
  }
}
 
Example 3
Source File: JPAEdmFacets.java    From cloud-odata-java with Apache License 2.0 4 votes vote down vote up
private static void setScale(final Column column, final SimpleProperty edmProperty) {
  if (column.scale() > 0) {
    ((Facets) edmProperty.getFacets()).setScale(column.scale());
  }
}