DescriptorQueryManager+EntityManager [message #734288] |
Fri, 07 October 2011 07:38  |
Eclipse User |
|
|
|
Hello,
I have a bit of a special case here. I have to access all my data through stored procedures. I have read lots of stuff about DescriptorCustomizer and DescriptorQueryManager. But do they apply at all if I use EntityManager? I got the feeling they do not.
What I have so far:
* entity
* @NamedStoredProcedureQuery for one selectall procedure that returns a cursor (hopefully this part is ok, but got no errors)
* @Customizer points to the DescriptorCustomizer
* DescriptorCustomizer.customize function sets DescriptorQueryManager.setReadAllQuery() to an instance of namedQuery. I get the named query from @PersistenceContext injected EntityManager.
I am quite sure the named procedure never gets called (I put a where clause to the sql which returns a cursor, but I get the full table).
I am sure something is wrong, but the question here is - should this approach work at all? Am I basically wrong in some assumption and this cannot be made to work anyway or maybe this should work somehow and I am just erring somewhere.
Anyway, I gotta figure this out soon. Or I guess I will be calling sql the usual jdbc way as I did all my life... and writing my own caching and stuff.
Thanks for any information regarding this.
And btw, eclipselink sessions seem quite arcane to me. Also that workbench is strange and illogical. Guess some artifact from Toplink or what? I don't want to have too much xml configs anyway since I like the new way with annotations much better.
|
|
|
|
Re: DescriptorQueryManager+EntityManager [message #743335 is a reply to message #735350] |
Fri, 21 October 2011 07:10  |
Eclipse User |
|
|
|
Yep, that link.
It doesn't work. At all. Tried a lot of scenarios and the queries from example never get called when using EntityManager.
I got ReadAllQuery working when using Session. But I don't want to use Sessions, too confusing and proprietary.
I guess I am defaulting to named queries as it seems the only possible alternative. Maybe you should just remove that wiki section since nothing seems to work as suggested? Also I am not filing bugs, don't have time. And I would probably get "not supported" answer anyway.
Something from the log:
FINER: client acquired: 26365814
FINER: TX binding to tx mgr, status=STATUS_ACTIVE
FINER: acquire unit of work: 18985130
FINEST: persist() operation called on: package.DataObject@6767df.
FINER: begin unit of work flush
FINER: TX beginTransaction, status=STATUS_ACTIVE
FINEST: Execute query InsertObjectQuery(package.DataObject@6767df)
FINEST: Execute query InsertObjectQuery(package.DataObject@6767df)
FINER: end unit of work flush
FINER: resume unit of work
FINER: TX beforeCompletion callback, status=STATUS_ACTIVE
FINER: begin unit of work commit
FINER: TX afterCompletion callback, status=COMMITTED
FINER: end unit of work commit
FINER: release unit of work
FINER: client released
Usually you would get sth like this:
FINEST: Execute query ReadAllQuery(name="DataObject.allrows" referenceClass=DataObject )
FINEST: Connection acquired from connection pool [default].
FINEST: reconnecting to external connection pool
FINE: BEGIN PROCNAME(ret_cur=>?); END;
bind => [2 parameters bound]
calling a named query in this case.
Persist as you can see just does nothing. Hence I am just guessing that DescriptorCustomizer is not coupled with jpa part of the implementation at all. I would suppose fixing the docs wouldn't hurt. Might save some poor sods some time.
|
|
|
Powered by
FUDForum. Page generated in 0.05828 seconds