summaryrefslogtreecommitdiffstats
path: root/proxy/code/src/org/fedoraproject/candlepin/model/ProductRepository.java
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2009-12-05 13:36:00 -0400
committerDevan Goodwin <dgoodwin@redhat.com>2009-12-05 13:36:00 -0400
commit1bee200575dda5cf1b41bf879f79471e47311740 (patch)
treef09a2c6debbe8293286ca317b7bb70eda67a054f /proxy/code/src/org/fedoraproject/candlepin/model/ProductRepository.java
parent0a1e68069524f42adc7539f8c94d5fbc7423c00a (diff)
downloadcandlepin-1bee200575dda5cf1b41bf879f79471e47311740.tar.gz
candlepin-1bee200575dda5cf1b41bf879f79471e47311740.tar.xz
candlepin-1bee200575dda5cf1b41bf879f79471e47311740.zip
Start testing the CertificateResource.
Diffstat (limited to 'proxy/code/src/org/fedoraproject/candlepin/model/ProductRepository.java')
-rw-r--r--proxy/code/src/org/fedoraproject/candlepin/model/ProductRepository.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/ProductRepository.java b/proxy/code/src/org/fedoraproject/candlepin/model/ProductRepository.java
new file mode 100644
index 0000000..0beaab0
--- /dev/null
+++ b/proxy/code/src/org/fedoraproject/candlepin/model/ProductRepository.java
@@ -0,0 +1,24 @@
+package org.fedoraproject.candlepin.model;
+
+import javax.persistence.EntityManager;
+
+import org.hibernate.criterion.Restrictions;
+
+public class ProductRepository extends AbstractHibernateRepository<Product> {
+
+ public ProductRepository(EntityManager em) {
+ super(Product.class);
+ }
+
+ public Product lookupByName(String name) {
+ return (Product) currentSession().createCriteria(Product.class)
+ .add(Restrictions.like("name", name))
+ .uniqueResult();
+ }
+
+ public Product lookupByLabel(String label) {
+ return (Product) currentSession().createCriteria(Product.class)
+ .add(Restrictions.like("label", label))
+ .uniqueResult();
+ }
+}