Main Overview Wiki Issues Forum Build Fisheye
Issue Details (XML | Word | Printable)

Key: CMP-213
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Shay Banon
Reporter: Roel Adriaensens
Votes: 0
Watchers: 1

If you were logged in you would be able to see more operations.

new gps device which supports custom hql queries that return multiple results per row

Created: 09/Jun/06 02:14 AM   Updated: 27/Jun/08 10:37 AM
Component/s: Compass::Gps
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. Java Source File (4 kB)
2. Java Source File (18 kB)
3. Java Source File (6 kB)
4. Zip Archive (32 kB)
5. Zip Archive (39 kB)

 Description  « Hide
I'm not using the hibernate device, since I have to deal with (legacy) business objects which do not reflect the relations that I want to index. (I can't change those objects) Those objects do have a hibernate mapping for their properties, but certain relations are not mapped since that is also not possible.
So actually I want to use a custom (hql) query that returns multiple results per row for the indexing. I also want to configure which results maps on which index properties, similar to the JdbcResultSetToPropertyMapping. Since the business objects don't reflect all the relations I want to index, it's also impossible to use the OSEM, unless I use lot's of custom property accessors...
Furthermore I'm not using the hit.getObject() functionality because I'm not sending the business objects to the client, but rather raw data (e.g. object[]) or xml. So I use the hit.getResource() method for querying. OSEM is thus only overhead and not usable for me.
I don't know if I'm making myself clear... but this is why I thought of a sort of HibernateResultSetDevice, which also uses the ScrollableResults from hibernate instead of the jdbc ResultSet.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Roel Adriaensens added a comment - 09/Jun/06 02:25 AM
Here's a first proposol for the implementation. Note that I only implemented the indexing part, not the mirroring part (everything related to the versioning). It also could use some refactorings, but it is at least a starting point...

Shay Banon added a comment - 13/Jun/06 09:03 AM
Looks great. I want to add it initially to the sandbox, but I want to ask for a few more things if you can:

Clean the commented code, and add a bit more javadocs.
If you can, move it to use pre Java 5 code.
And the most important thing, unit test it (I have no problems with HSQL as the database for example, have a look at the Hibernate device tests and the ResultSet tests).

Roel Adriaensens added a comment - 16/Jun/06 02:06 AM
Ok I'll try as soon as I have some time!

Roel Adriaensens added a comment - 22/Jun/06 02:46 AM
Hi Shay,

I put some effort in :

  • unit tests
  • pre java 5 code
  • mirroring code

The indexing part seems ok, but I still have some issues with the mirroring part. For some reason there is a problem with the synchronisation between the JTATransaction and the hibernate session.
If I a use getCurrentSession() in the HibernateSessionWrapper of the gps device, hibernate is not able to find the JTATransaction.
And if I use openSession(), the unit tests without mirroring work, but the unit test for the mirroring fails because of failure to synchronize the JTATransaction with the hibernate session.
I would like to use getCurrentSession().... but I don't understand why it's unable to find the transaction...
can you have a look at it (


Roel Adriaensens added a comment - 01/Aug/06 03:59 AM
Hi Shay,

here's a full implementation (, including working unit tests. However, the unit tests will only succeed if CMP-240 is fixed, otherwise you'll get a ClassCastException due to wrong use of isAssignableFrom() statement in RawResourceMappingConverter.

Let me know what you think of it... can you add this to the codebase?


Shay Banon added a comment - 24/Nov/06 07:00 AM
Added this the the sandbox in Compass, thanks!. This is a really nice addition to Compass, what we have left is enhance the javadoc and write a chapter about it in the reference documentation. Hopefully by 1.1 release?


Sorry it took so long mate, my bad.