function « MySQL « JPA Q&A

1. Why does Hibernate re-implement functionality that databases already have?

For example:

@Table(name = "stock", catalog = "mkyong", uniqueConstraints = {
@UniqueConstraint(columnNames = "STOCK_NAME"),
@UniqueConstraint(columnNames = "STOCK_CODE") })
@Column(name = "STOCK_NAME", unique = true, nullable = false, length = 20)
Constraints like 'unique', 'nullable', even ...

2. Hibernate - Injecting MySql Functions

Is is possible using Hibernate (prefferably the Criteria API) to use a mySql function to Order By. The function I am looking to use is :-

SQRT( POW( 69.1 * ( {alias}.latitude - ...

3. How to register and use a MySQL function programmatically

If parameters depends on entity fields, you can map your function via @Formula annotation. For example: Code: @javax.persistence.Table(name = "USER_LOGINS") @Entity public class UserLoginEntity { private Long userId; @Column(name = "USER_ID") @Id public Long getUserId() { return ...

4. MySql function

5. help with hibernate and mysql function now()

6. using built in functions from mysql

hello hibernate users a have a very simple schema set up with hibernate working fine so far. i use criteria to search for a particular rows now i need to use a built in function from mysql. the query is like so: select dayofmonth(list_date) from top_ten_title where list_date between '2004-7-1' and '2004-8-1'; can i use criteria for this also, or what ...