19 | object, which is a Long object reflecting the number of Country objects in the database: TypedQuery<Long> query = em.createQuery( "SELECT COUNT(c) FROM Country c", Long.class); long ... Country c"); long countryCount = (Long)query.getSingleResult(); An aggregate COUNT query |
17 | (strategy=GenerationType.AUTO) long id; : } AUTO is the default strategy, so the following definition is equivalent: @Entity public class EntityWithAutoId2 { @Id @GeneratedValue long ... @GeneratedValue(strategy=GenerationType.IDENTITY) long id; : } The IDENTITY strategy |
16 | and primary key: em.find(MyEntity2.class, Long.valueOf(1), Collections.<String,Object ... , Long.valueOf(1), Collections.<String,Object>singletonMap( "javax.persistence ... is cached: boolean isCached = cache.contains(MyEntity.class, Long.valueOf(id)); Cached entity |
16 | (for persistent fields) Primitive types (boolean, byte, short, char, int, long, float, double). Wrapper types (Boolean, Byte, Short, Character, Integer, Long, Float, Double). java.lang.String Date types: java ... , char, int, long, float and double). Wrappers (Boolean, Byte, Short, Character, Integer, Long |
13 | : boolean, byte, short, char, int, long, float and double. Equivalent wrapper classes from package java.lang: Boolean, Byte, Short, Character, Integer, Long, Float and Double. java.math.BigInteger ... ) collection and map types are supported, as long as their values (i.e. elements in collections and arrays |
13 | Java (e.g. for int and long operands the MOD function returns a long value). The SQRT Function ... , but all the numeric types (byte, short, int, long, float, double, BigInteger, BigDecimal) are supported. Unary |
13 | functions of SQL: COUNT - returns a long value representing the number of elements. SUM - returns the sum ... in that letter's group as a Long object and the third cell contains the distinct number ... interface provides methods for building aggregate expressions: count, countDistinct - return a long type |
2 | implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue private long id; private int x; private int y; public Point() { } Point(int x, int y) { this.x = x; this.y = y; } public Long getId |
2 | { private static final long serialVersionUID = 1L; @Id @GeneratedValue private long ... y) { this.x = x; this.y = y; } public Long getId() { return |
2 | .persistence.Id; @Entity public class Guest implements Serializable { private static final long serialVersionUID = 1L; // Persistent Fields: @Id @GeneratedValue Long id |