Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: JPA MetaModel with RMI and DetachedCriteria
PostPosted: Mon Oct 09, 2017 3:50 am 
Newbie

Joined: Mon May 29, 2006 6:14 am
Posts: 17
Hi,

Our application is based on RMI client/server. For get data from database on client side, The created DetachedCriteria for query and calling rmi method with DetachedCriteria parameter and taking result from server. We don't use any hibernate session on Client. All session operation is make on server. Is it good solution?

But now we want to metamodel in DetachedCriteria. We won't use DetachedCriteria properties as String.(Below)

Code:
DetachedCriteria dc = DetachedCriteria.forClass(TblCompanymaster.class);      
dc = dc.setFetchMode("tblCompanymasters", FetchMode.JOIN);//we don't use "tblCompanymasters". We want to use TblCompanymaster_.tblCompanymasters


we don't use "tblCompanymasters" as string. We want to use TblCompanymaster_.tblCompanymasters.
What is the solution for using metamodel on client side for query. Is there alternative DetachedCriteria class for use Metamodel?

Thank you


Top
 Profile  
 
 Post subject: Re: MetaModel Using on RMI client side
PostPosted: Mon Oct 09, 2017 4:20 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1588
Location: Romania
Quote:
Is it a good solution?


Why don't you use REST or Web Services for this? It's a much better approach than RMI whose original goal was to provide a way to call remote EJBs. However, it proved to be a bad design since it's much easier to scale front-end web nodes than remote EJB beans. That's why REST is so popular while EJB 2.0 is just a distant memory.

Code:
But now we want to metamodel in DetachedCriteria.


It will not work. DetachedCriteria is a Hibernate-specific API while Metamodel is a JPA-base done. These two have nothing in common, and DetachehdCriteria along with the entire Hibernate-specific Criteria is deprecated and will be removed in a future version.

So, if you want to use the JPA type-safe Metamodel, you need to use JPA and switch from Hibernate Criteria to JPA one.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: JPA MetaModel with RMI and DetachedCriteria
PostPosted: Mon Oct 09, 2017 4:37 am 
Newbie

Joined: Mon May 29, 2006 6:14 am
Posts: 17
Ok. We can't switch web servis or REST but We can switch JPA
How can I send more complex query to server with JPA. Is there any way. Normally we created DetachedCriteria


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.