1 21 package oracle.toplink.essentials.queryframework; 23 24 25 import oracle.toplink.essentials.exceptions.DatabaseException; 26 import oracle.toplink.essentials.exceptions.OptimisticLockException; 27 import java.util.HashMap ; 28 import oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl; 29 import oracle.toplink.essentials.sessions.Session; 30 31 32 40 41 public class EJBQLPlaceHolderQuery extends DatabaseQuery { 42 43 private String ejbQLString; 44 private Boolean flushOnExecute; 45 private HashMap hints; 46 47 public EJBQLPlaceHolderQuery() { 48 } 49 public EJBQLPlaceHolderQuery(String ejbQLString) { 50 this.ejbQLString=ejbQLString; 51 } 52 public EJBQLPlaceHolderQuery(String name, String ejbql, HashMap hints) { 54 this.name=name; 55 this.ejbQLString=ejbql; 56 this.flushOnExecute=null; 57 this.hints=hints; 58 } 59 60 public EJBQLPlaceHolderQuery(String name, String ejbql, Boolean flushOnExecute, HashMap hints) { 61 this.name=name; 62 this.ejbQLString=ejbql; 63 this.flushOnExecute=flushOnExecute; 64 this.hints=hints; 65 } 66 67 74 public String getEJBQLString(){ 75 return ejbQLString; 76 } 77 public void setEJBQLString(String ejbQLString){ 78 this.ejbQLString = ejbQLString; 79 } 80 81 86 public HashMap getHints(){ 87 return hints; 88 } 89 public void setHints(HashMap hints){ 90 this.hints = hints; 91 } 92 93 94 public DatabaseQuery processEjbQLQuery(Session session){ 95 ClassLoader classloader = session.getDatasourcePlatform().getConversionManager().getLoader(); 96 DatabaseQuery ejbquery = EJBQueryImpl.buildEJBQLDatabaseQuery(ejbQLString, flushOnExecute, session, hints, classloader); 97 ejbquery.setName(this.getName()); 98 return ejbquery; 99 } 100 101 102 103 113 public Object executeDatabaseQuery() throws DatabaseException, OptimisticLockException{ 114 DatabaseQuery ejbquery = processEjbQLQuery(this.getSession()); 115 return ejbquery.executeDatabaseQuery(); 116 } 117 } 118 | Popular Tags |