Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO/Hibernate] Examples: Why Query with CDOTransaction and not CDOView?(Wondering why the queries are done with CDOTransaction and not with CDOView)
[CDO/Hibernate] Examples: Why Query with CDOTransaction and not CDOView? [message #899553] Wed, 01 August 2012 12:05 Go to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 386
Registered: December 2010
Location: Germany
Senior Member
Hello

I have been studing the example projects org.eclipse.emf.cdo.examples.hibernate.*. I noticed that the queries in HibernateQueryTest are always created through a CDOTransaction.

public void testSimpleQueries() throws Exception
{
	CDOSession session = openSession();
	CDOTransaction transaction = session.openTransaction();
	{
	  CDOQuery cdoQuery = transaction.createQuery("hql", "from Product"); //$NON-NLS-1$  //$NON-NLS-2$
	  final List<Product> products = cdoQuery.getResult(Product.class);
	  assertEquals(NUM_OF_PRODUCTS, products.size());
	}
	...
	transaction.commit();
}

From the documentation I would have expected a CDOView to be used. Is there a special reason to use a CDOTransaction in this scenario? I.e. is it necessary to commit the selection because the objects are locked in some way or to free the query for garbage collection?

Greetings
Christoph

P.S. I needed to add org.eclipse.emf.ecore.change to the manifest of org.eclipse.emf.cdo.examples.hibernate.client for the tests to run.
Re: [CDO/Hibernate] Examples: Why Query with CDOTransaction and not CDOView? [message #899575 is a reply to message #899553] Wed, 01 August 2012 13:44 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5340
Registered: July 2009
Senior Member
Hi Christoph,
No special reason, thanks for the note ecore.change, I hope to spend time on CDO Hibernate Store in august and solve
this and some other issues.

gr. Martin

On 08/01/2012 02:05 PM, Christoph Keimel wrote:
> Hello
>
> I have been studing the example projects org.eclipse.emf.cdo.examples.hibernate.*. I noticed that the queries in
> HibernateQueryTest are always created through a CDOTransaction.
> public void testSimpleQueries() throws Exception
> {
> CDOSession session = openSession();
> CDOTransaction transaction = session.openTransaction();
> {
> CDOQuery cdoQuery = transaction.createQuery("hql", "from Product"); //$NON-NLS-1$ //$NON-NLS-2$
> final List<Product> products = cdoQuery.getResult(Product.class);
> assertEquals(NUM_OF_PRODUCTS, products.size());
> }
> ...
> transaction.commit();
> }
> From the documentation I would have expected a CDOView to be used. Is there a special reason to use a CDOTransaction in
> this scenario? I.e. is it necessary to commit the selection because the objects are locked in some way or to free the
> query for garbage collection?
>
> Greetings
> Christoph
>
> P.S. I needed to add org.eclipse.emf.ecore.change to the manifest of org.eclipse.emf.cdo.examples.hibernate.client for
> the tests to run.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [CDO/Hibernate] Examples: Why Query with CDOTransaction and not CDOView? [message #899585 is a reply to message #899575] Wed, 01 August 2012 14:12 Go to previous message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 386
Registered: December 2010
Location: Germany
Senior Member
@Martin: Thanks for the quick reply!
Previous Topic:Model file suffix mandatory
Next Topic:[CDO/Hibernate] Can Hibernate Validation be used with CDO/Teneo?
Goto Forum:
  


Current Time: Sun Dec 21 02:38:57 GMT 2014

Powered by FUDForum. Page generated in 0.13060 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software