Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » HOW do you Query for multiple values with Texo/JSON REST Web Services(Using Texo JSON/Webservices)
|
Re: HOW do you Query for multiple values with Texo/JSON REST Web Services [message #1132801 is a reply to message #1132502] |
Fri, 11 October 2013 11:55 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi David,
See this section, it contains examples on how to get multiple values for an object using queries:
http://wiki.eclipse.org/Texo/JSON_REST_Web_Services#Querying
Should be something like this:
{
"_eclass": "request|QueryType",
"query": "select e, e.author.name from library_Book e where e.title like :title",
"parameters": [{
"name": "title",
"value": "title2%"
}]
}
I have not tested with multiple derived values though, but it should work.
You should also check how your ORM does the joining of these additional values, there is a 'danger' that an inner-join
is being used, which would prevent any records with null values showing up.
gr. Martin
On 10/11/2013 01:04 PM, namboka david wrote:
> Hello,
> I'm trying to use the Texo webservice. I have managed to do the basic calls on one object a get all the data on one
> given object.
>
>
>
> But this object has data in a grid which has derived data from other referred-to-entities : proxies. For instance the
> Fournisseur object.
>
> I am trying to build a grid and I need these other objects.
>
> Can you give me an example off how to query the main object un its proxy objects at the same time ?
>
> Regards
>
> David Namboka
--
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: HOW do you Query for multiple values with Texo/JSON REST Web Services [message #1137241 is a reply to message #1137153] |
Mon, 14 October 2013 10:55 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi David,
Afaics the request is a json object with one of the fields being the query. Can you give some more details on what you
think of? (for example I am not sure that BOOK+WRITER will work, I guess maybe BOOK+author, but I can also imagine using
a separate json parameter with additionalProperties: author, author.name etc.
gr. Martin
On 10/14/2013 11:45 AM, namboka david wrote:
> Hello Martin,
> Would it be possible to have a JSON formatted request instead of a query which would fetch all the needed data ? Instead
> of posting a sql formatted query as you sent in the previous answer ? For instance
> org.eclipse.emf.texo.web.example/jsonws/BOOK+WRITER ?
>
> Regards
--
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: HOW do you Query for multiple values with Texo/JSON REST Web Services [message #1196586 is a reply to message #1137241] |
Tue, 19 November 2013 13:43 |
namboka david Messages: 13 Registered: September 2013 |
Junior Member |
|
|
Hello Martin,
I have been using TEXO for the last months. It is really an impressive tool. I have two questions though. I was wondering if TEXO could be used in another JAVA project. For instance an Entreprise Application Project.
Secondly I am facing a dilema. For a project, I need to convert business typed object to MySQL VARCHAR,TINYINT,SMALLINT,MEDIUMINT,INT,BIGINT. Unfortunately, using Texo, all I get in MySQL's Workbench are objects.
Could you indicate where, in TEXO, I can do the mapping of my business object types to Mysql native types ?
Regards
|
|
|
Re: HOW do you Query for multiple values with Texo/JSON REST Web Services [message #1196687 is a reply to message #1196586] |
Tue, 19 November 2013 14:42 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi David,
Afaics you can use Texo in any web project. Texo is based on my experience as software architect at Openbravo (an open
source ERP), and imo Texo can definitely be used in enterprise application projects. See this wiki link for the
dependencies:
http://wiki.eclipse.org/Texo/Download_and_Install#Runtime_usage.2C_web_container
For your mysql question, I don't yet fully understand, Texo uses JPA/ORM to persist in the database, the column types in
the database should be as you want: varchar, tinyint, etc.
Or are you somehow from mysql workbench calling JPA/ORM or the json webservice layer? If so can you give some links to
docs, I am interested to know your use case to also better answer your question.
gr. Martin
On 11/19/2013 02:43 PM, namboka david wrote:
> Hello Martin,
>
> I have been using TEXO for the last months. It is really an impressive tool. I have two questions though. I was
> wondering if TEXO could be used in another JAVA project. For instance an Entreprise Application Project.
> Secondly I am facing a dilema. For a project, I need to convert business typed object to MySQL
> VARCHAR,TINYINT,SMALLINT,MEDIUMINT,INT,BIGINT. Unfortunately, using Texo, all I get in MySQL's Workbench are objects.
> Could you indicate where, in TEXO, I can do the mapping of my business object types to Mysql native types ?
> Regards
--
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: HOW do you Query for multiple values with Texo/JSON REST Web Services [message #1198630 is a reply to message #1198520] |
Wed, 20 November 2013 12:25 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi David,
It all depends and I know opinions out there differ, but you ask for my opinion :-).
Constraints/validations which can be applied without any contextual knowledge and which are needed for the validity of
persisted data can be done on the data object, for example not-null constraints in the database or only allow positive
integers values in specific member.
But any constraint which needs contextual information (or the value of other attributes) can best be implemented outside
of the data object. There are cases where a data object is being constructed/set and its values are partially set,
validation can not happen when calling a setter then, the whole object needs to be constructed/set before validation can
take place.
I am in favor of light data objects, which serve more as a kind of hashmap/key-value pair and have the main behavior
(incl. validation) implemented in separately pluggable service classes.
So imho I would not do constraint checking in the object itself (except for special cases, there are always special
cases), and do most constraint checking/validation in a separate layer.
Hope this answers your question.
gr. Martin
On 11/20/2013 12:15 PM, namboka david wrote:
> Thank you for the quick answer Martin. I'm going to come up with a tighter explanation of the issue. Next post should be
> more precise. In the meantime, I'm glad to learn that you had worked as a software architect on OpenBravo. In fact my
> functional environment is close to ERP's.
> I have a more pattern oriented question I would like to ask concerning your approach on TEXO. As far as my use of the
> tool is concerned, I understand TEXO generates plain old java objects on which JPA annotations are added. No extra
> intelligence is added on those objects except assessors for object attributes. Which clearly sounds reasonable.
>
> Now what if one needed to added checking routines on values affected to those attributes.
> Two different approaches could be used. Either by enrichening the body of the assessor associated to the attribute.
> Either by adding another layer above the models and adding the check routines in that layer. I would like to have your
> opinion on that question, based on your experience. Would you leave the model as POJO objects on which a sort of control
> layer is added for any extra intelligence injection ? Or would you enrich the body of those POJO assessors ?
> Would the DAO object be a good place to add that extra intelligence ?
>
>
>
>
--
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: HOW do you Query for multiple values with Texo/JSON REST Web Services [message #1198757 is a reply to message #1198741] |
Wed, 20 November 2013 13:46 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
A dao could be seen as a service, so a daofactory can be used to make it configurable what Dao implementation is being
used.
The same for validation, you can create separate validators for each eclass (the approach followed by EMF standard also).
So in my view an application is a set of service classes which are instantiated on the fly and pluggable (i.e. can be
replaced by other implementations), the data traveling through these service classes are simple pojos.
The service classes should implement an api defined by an abstract class (I don't particurarly like interfaces as they
make result in binary incompatibility when extending the api, it is better (all imho) to use abstract classes with
default implementations of the api where it makes sense).
gr. Martin
On 11/20/2013 02:38 PM, namboka david wrote:
> Oh, by the way just for record what do you mean by separately pluggable service classes ?
--
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
|
|
| |
Goto Forum:
Current Time: Fri Mar 29 12:29:33 GMT 2024
Powered by FUDForum. Page generated in 0.03016 seconds
|