differences between load and exec

4 views
Skip to first unread message

uoc

unread,
Jul 21, 2010, 11:45:21 AM7/21/10
to jenabe...@googlegroups.com
Hi,

Ive had reason to move my code from using load and loadDeep to executing
sparql - I need to filter the individuals returned based on a status
property. I now construct the sparql and pass to exec. However Im
finding that the collection properties on the object returned are
"LazySets" and when I "getMyCollection()" property on the object Im
getting strange SQL exceptions. Whats going on ???

2010-07-21 16:28:23,981 [main] WARN sql.SDBConnection - execQuery:
SQLException
Connection is closed.
SELECT -- V_1=?o
R_1.lex AS V_1_lex, R_1.datatype AS V_1_datatype, R_1.lang AS
V_1_lang, R_1.type AS V_1_type
FROM


Pulling my hair out now.

Taylor Cowan

unread,
Jul 21, 2010, 2:08:41 PM7/21/10
to jenabe...@googlegroups.com
Sql exceptions? Thats not jb. Lazy collections get values when accessed, intent is performance.

Sent from my HTC

Hi,

--
You received this message because you are subscribed to the Google Groups "jenabean-dev" group.
To post to this group, send email to jenabe...@googlegroups.com.
To unsubscribe from this group, send email to jenabean-dev...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jenabean-dev?hl=en.


uoc

unread,
Jul 21, 2010, 2:10:03 PM7/21/10
to jenabe...@googlegroups.com, Taylor Cowan
This is happening because I have externally managed connections and a 3
tier architecture
1. I make a web request to get an object
2. the object is retrieved with lazy sets
3. the object is serialized to json, pulling collections
4. the object is rendered

Ive tried in 1 to force the collections in lazy sets and list to be
loaded by reflecting on the objects and doing a method invoke on getters
that are assignable from LazySet|LazyList. This seems to work at the web
tier - I can call the collection getters without getting a connection
closed sql exception. But - if I try and serlialize these as json by
passing the Jackson (Im using Spring3), things go bad again.

Is there a way around this, or an alternative way of doing a deep or at
least one-level-deep collection load on objects, or is there a way to do
more than a simple read of objects of a certain class - "get me objects
of type x where property a=y" - without having to use exec ?

OSIV ?

uoc

unread,
Jul 22, 2010, 1:59:55 PM7/22/10
to jenabe...@googlegroups.com, Taylor Cowan
On 21/07/2010 19:08, Taylor Cowan wrote:
> Sql exceptions? Thats not jb. Lazy collections get values when accessed, intent is performance.
>
> Sent from my HTC
>
> -----Original Message-----
> From: uoc<uoc...@gmail.com>
> Sent: 21 July 2010 10:45 AM
> To: jenabe...@googlegroups.com
> Subject: differences between load and exec
>
> Hi,
>
> Ive had reason to move my code from using load and loadDeep to executing
> sparql - I need to filter the individuals returned based on a status
> property. I now construct the sparql and pass to exec. However Im
> finding that the collection properties on the object returned are
> "LazySets" and when I "getMyCollection()" property on the object Im
> getting strange SQL exceptions. Whats going on ???
>
> 2010-07-21 16:28:23,981 [main] WARN sql.SDBConnection - execQuery:
> SQLException
> Connection is closed.
> SELECT -- V_1=?o
> R_1.lex AS V_1_lex, R_1.datatype AS V_1_datatype, R_1.lang AS
> V_1_lang, R_1.type AS V_1_type
> FROM
>
>
> Pulling my hair out now.
>
>
All my hair is gone.

Rolled my own connection-per-thread filter to emulate OSIV, but have
come a cropper now with requests being forwarded to JSP/Jackson once the
domain objects have been retrived with lazy load exec(). Request
dispatcher is forwarding to jsp on a different thread or Tomcat isnt
following my configuration to invoke filters on forwards so Im
pessimistic that Im going to solve this. Even tried a Spring JPA entity
manager factory with a Datasource capable jpaDialect, but this just
messed with SDB and I ended up with hung app and corrupt data.

My alternative is to walk the domain object and convert to a view object
before handing it off to JSP/Jackson or do something different and wipe
out a lot of code and effort over the past few months.

Any suggestions ?

uoc

unread,
Jul 22, 2010, 3:58:46 PM7/22/10
to jenabe...@googlegroups.com, Taylor Cowan

Looks like its my Authentication code - logged in user is cached,
subsequent requests expect all info to be available, but connection is
closed by then. Have reverted this to loadDeep and added app logic to
check things that the exec query would have filtered out. Now just have
to find out why exec on the rest seems to be about 10x slower than loadDeep.

uoc

unread,
Jul 23, 2010, 1:20:14 PM7/23/10
to jenabe...@googlegroups.com, Taylor Cowan
  • Use a lazyDataSource to prevent unneccessary network calls
  • use read(class) rather than exec selectively where data volumes can be kept in mem - x4 fasterish
  • use a quick network connection
  • use a quick database server
  • back out crap done over the last few days.
  • still need osiv for some operations, probably
Thanks for all the help.


Reply all
Reply to author
Forward
0 new messages