ah thanks...good optimizations...
I guess nothing was grievously broken in the original version...was
hoping something was so I could get back lost memory! :-)
On 10/25/2011 6:02 AM, Leszek Gawron wrote:
On 2011-10-25 11:43, Robby Pelssers wrote:
He should have known that ;-)
For all I know this is still Java
Criteria criteria = null;
While this is the javascript version:
var criteria = null;
Robby
oops you got me :) That is probably the fault of no-morning-coffee-yet
Anyways the code should looke somewhat like this:
public Object[] getObjectListbySQL(Object obj, String sql) {
if(obj == null)
return null;
PersistenceBroker broker = null;
try {
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
broker.clearCache();
// get the QueryBySQL
QueryBySQL q = QueryFactory.newQuery(obj.getClass(), sql);
return ((Collection)broker.getCollectionByQuery(q)).toArray();
} catch (Exception sqle) {
// doing printStackTrace is usually bad practice
// either log it or rethrow it
// sqle.printStackTrace();
throw new MyRuntimeDataAcessException( "unable to fetch
data", sqle );
} finally {
if ( broker != null )
broker.close();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]