This content has been marked as final.
Show 1 reply
-
1. Re: Query on each access
wachtda.scsi.gmx.ch Mar 6, 2008 5:08 PM (in response to wachtda.scsi.gmx.ch)I read in the old forum that JSF don't cache anything.
Now I don't know how I should retrieve my Objects without forcing multiple db-querys...
Because I loop trough my devices which can have many log entries I need to call a function which gets all log entries with the given device id.For the the beginning I now made a dirty hack:
String m_OldDeviceID; public List<LogEntry> logEntriesByDevice(long p_DeviceID) { // Ugly ugly hack for multiple calls if(p_DeviceID != m_OldDeviceID) { m_DeviceLogEntries = m_EM.createQuery("SELECT le FROM LogEntry le WHERE le.device.ID = :deviceID") .setParameter("deviceID", p_DeviceID) .getResultList(); } m_OldDeviceID = p_DeviceID; return m_DeviceLogEntries; }
I think this is not the right way! Does anybody has a hint for me how I should retrieve my log entries without force multiple db queries...
Thanx Daniel