[hibernate-dev] hooking native MongoDB queries on mapped entities

Davide D'Alto davide at hibernate.org
Wed Apr 10 12:25:36 EDT 2013


I forgot to add the link to the commit:
https://github.com/DavideD/hibernate-ogm/commit/c0426378671b2e73c9450b43d55e09ba8af00f3c


On Wed, Apr 10, 2013 at 5:24 PM, Davide D'Alto <davide at hibernate.org> wrote:

> As an experiment I've added a method to the mongodb provider:
> MongoDBDatastoreProvider#(Session session, String sqlString, Class<T>
> entityType)
> With this method it is possible to execute a native query like "{ $query :
> { author : 'Oscar Wilde' }, $orderby : { name : 1 } }" that will return a
> MongoDBOgmCursor that is similar to the DBCursor except that it returns an
> Object of the type entityType.
>
> I'm using the same approach used for the OgmMassIndexer therefore the
> return type must be en entity.
>
> Do you think something like this can be useful?
>
>
> On Mon, Apr 8, 2013 at 12:09 PM, Emmanuel Bernard <emmanuel at hibernate.org>wrote:
>
>> From what I understand, this would be equivalent to the
>> @NAtiveNamedQuery support in JPA where you define the binding between
>> the result set and the objects. We can give it a shot. I wonder how much
>> of this is related to the JP-QL query mechanism though and should be
>> shared.
>>
>> Emmanuel
>>
>> On Sun 2013-04-07 14:19, Sanne Grinovero wrote:
>> > Looks like a good idea:
>> > https://forum.hibernate.org/viewtopic.php?f=31&t=1025793
>> >
>> > Davide can you help them figuring out how to hook it all up?
>> >
>> > Sanne
>> > _______________________________________________
>> > hibernate-dev mailing list
>> > hibernate-dev at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>
>
>


More information about the hibernate-dev mailing list