ch.bouquet.jpa.persistence
Class SearchBean

java.lang.Object
  extended by ch.bouquet.jpa.persistence.SearchBean
All Implemented Interfaces:
java.io.Serializable

public class SearchBean
extends java.lang.Object
implements java.io.Serializable

CAS Enterprise Application Development mit Java EE (EADJ) - 2007
Modul: Data-Tier (JPA)
User admininstration (examination question)
Description:
This class encases the inquiries by JPQL on the table search

Copyright (c) 2007 bouquet dot ch, 3032 Hinterkappelen. All rights reseved.

Version:
1.0 - 04.06.2007
Author:
Marc Bouquet ( marc at bouquet dot ch, Swiss )
See Also:
Serialized Form

Field Summary
private  javax.persistence.EntityManager em
          The entity manager
private static org.apache.log4j.Logger LOG
          constant for the logging
private static long serialVersionUID
          Default serial version uid
 
Constructor Summary
SearchBean(javax.persistence.EntityManager em)
          Default constructor.
 
Method Summary
 java.util.List<Search> findList(java.lang.String sql)
          This method returns all data records on the basis the SQL instruction.
 Search findSingle(java.lang.String sql)
          This method returns a data record on the basis the SQL instruction.
 boolean remove(int id)
          Remove the search for the given key if available.
 Search save(Search search)
          Insert new or update existing search using the given entity and return the persistet fields of the search.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Default serial version uid

See Also:
Constant Field Values

LOG

private static org.apache.log4j.Logger LOG
constant for the logging


em

private javax.persistence.EntityManager em
The entity manager

Constructor Detail

SearchBean

public SearchBean(javax.persistence.EntityManager em)
Default constructor.

Parameters:
em - EntityManager
Method Detail

findSingle

public Search findSingle(java.lang.String sql)
                  throws javax.persistence.NoResultException
This method returns a data record on the basis the SQL instruction.

Parameters:
sql - String SQL-Query
Returns:
search found
Throws:
javax.persistence.NoResultException

findList

public java.util.List<Search> findList(java.lang.String sql)
This method returns all data records on the basis the SQL instruction.

Parameters:
sql - String SQL-Query
Returns:
list of searchs or null

remove

public boolean remove(int id)
               throws javax.persistence.NoResultException
Remove the search for the given key if available.

Parameters:
id - primary key
Returns:
true=removed, false=can't removed
Throws:
javax.persistence.NoResultException

save

public Search save(Search search)
            throws javax.persistence.NoResultException
Insert new or update existing search using the given entity and return the persistet fields of the search.

Parameters:
search - to save
Returns:
search saved or updated
Throws:
javax.persistence.NoResultException


Copyright © 2007 - bouquet dot ch, 3032 Hinterkappelen. All Rights Reserved.