/* License see bottom */
package jtrackbase.db;
import java.util.Collection;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import oracle.toplink.essentials.exceptions.DatabaseException;
public class LabelFacade extends AbstractFacade {
public static Collection<Label> findAll() {
EntityManager em=DBController.getEntityManager();
Query query = em.createQuery("SELECT l FROM Label l");
Collection<Label> mt=null;
try {
mt=castToList(query.getResultList());
} catch (DatabaseException ex) {
}
return mt;
}
public static Collection<Label> findByName(String n) {
EntityManager em=DBController.getEntityManager();
Query queryLabel = em.createNativeQuery(
"Select * from Label where name = #lName", Label.class
);
queryLabel.setParameter("lName", n);
return castToList(queryLabel.getResultList());
}
}
/*
Copyright (C) 2008 Onkobu Tanaake
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program (gplv3.txt).
*/