|
Re: JPA CriteriaQuery MD5 [message #1007347 is a reply to message #1006338] |
Tue, 05 February 2013 15:30 |
|
This would probably be better as a native SQL query, as it is complex and data specific.
The Criteria API does not support sub-selects in the from clause, so you would need to reword the query. To call the MD5 function you can use the function() API in Criteria.
What is your object model?
James : Wiki : Book : Blog : Twitter
|
|
|
Re: JPA CriteriaQuery MD5 [message #1007750 is a reply to message #1007347] |
Thu, 07 February 2013 12:04 |
Super User Messages: 9 Registered: January 2013 |
Junior Member |
|
|
Greetings Mr. Sutherland,
Thank you for you answer.
I use simplest object model here:
@Entity
@Table(name = "db_emails")
class Email implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Long id;
@Column(name = "title")
private String title;
@Column(name = "from")
private String from;
@Column(name = "to")
private String to;
@Column(name = "content")
private String content;
@Column(name = "digest")
private String digest;
/*
Getters and setters are being declared here
*/
}
It looks I made misprint in topic start message. Query I'm rtying to make with CriteriaQueries is about quering same table twice
select tmp from db_emails
(select * from db_emails where folder="spam") tmp
where tmp.digest=md5(concat("digest",?))
Thanks in advance,
[Updated on: Mon, 11 February 2013 18:53] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03237 seconds