Tue Mar 23, 2010 11:17 pm
List<Topic> results = entitymanager.createQuery(
"select t from Topic t where t.creationDate in (:datesList)")
.setParameter("datesList", datesList)
.getResultList();
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
<named-query name="getTopicsFromList">
<query>select t from Topic t where t.creationDate in (:datesList)</query>
</named-query>
</entity-mappings>
public List<Topic> getTopicsFromDates(List<Date> dateList) {
List<Topic> topicList = null;
javax.persistence.Query query;
try {
query = entitymanager.createNamedQuery("getTopicsFromList");
query.setParameter("datesList", dateList) ;
topicList = query.getResultList();
} catch (Exception exception) {
exception.printStackTrace();
}
return topicList ;
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.