Sorry for the delay on the new feature. I was experimenting with using
a TransientStateManager, and the effects it would have on an object that
is made persistent.
I would like to send the JDO group some source code that is generic enough
to include as part of the JDO release.
Since I did much of the original work for 3M, I'm wondering what is your
policy about sharing source code? Can their be a Originally developed by
3M indicator in the source code that would remain during distribution?
I'm still checking with 3M about its open source policy, so I hope I can
share this, but we will see.
Thanks,
Tim Gallagher
Clinical Economic Research
3M Health Information Systems
5000 Buttercup Drive
Castle Rock, CO 80109
Phone: (303) 814-3867
From:
tgallag...@mmm.com
To:
jdo-dev@db.apache.org
Date:
11/03/2011 05:39 PM
Subject:
Re: New Feature Idea
Matthew,
Thanks for the link. I like that query functionality. That will cover
everything that would ever be required.
However, I would also propose to also include the following which would be
a really easy mechanism query data. I'll show it as an example using the
example on the page you listed and continuing with the Product object:
@PersistenceCapable
public class Product
{
@PrimaryKey
long id;
String name;
double value;
...
}
Suppose you wanted all the products that start with Wal, then the code
would be something like this:
Product product = new Product();
product.setName(Wal%);
ListProduct products =
JDORecord_Utils.loadByExample(this.persistenceManager, Product.class,
product, name);
In the example above, the loadByExample parameters are:
persistence Manager
candidate class
example object
sorting field name
This results in a JDO query of:
SELECT FROM mydomain.Product
WHERE this.name.startsWith(Wal)
ORDER BY this.name ASCENDING
In the case where the example object is null, the JDO query becomes:
SELECT FROM mydomain.Product
ORDER BY this.name ASCENDING
Let's say you wanted to do a subquery to find all Inventory objects
containing a Product of a particular name.
Product product = new Product();
product.setName(Wal%);
ListInventory inventory =
JdoRecord_Utils.executeSubqueryByExample(this.persistenceManager,
Product.class, product, id, Invetory.class, null);
In the example above, the executeSubqueryByExample parameters are:
persistence Manager
sub query candidate class
sub query example object
connecting field name
candidate class
example object
I understand that it is not a robust as the TypeSafe queries, and I will
definitely make use of TypeSafe queries as needed. However, the above is
very useful for most of what I've seen over the years. My experience is
building business layers that connect to datastores and building them in
such a way that the GUI builders never include any queries/SQL directly in
their code, which allows changing the datastore type and architecture
without effecting the GUIs.
The issue I have is that even though JDO actually keeps track of what
values have changed within a bean, there is no easy way to determine that
from the developer's perspective. So, I have to create a mechanism within
the beans myself (items that are not persisted) in order to make this all
work. If there were at least a way to easily gain that changed field
information from a JDO object that would be great. And from that
indicator I would be able to get the field name and type using reflection.
Getting the changed field indicators is what would make the QBE work.
If I'm mistaken in not being able to get a change indicator that reliably
identifies a field in the bean, please let me know how that is done. From
the documentation there does not appear to be a standard way of doing
this.
Tim Gallagher
Clinical Economic Research
3M Health Information Systems
5000 Buttercup Drive
Castle Rock, CO 80109
Phone: (303) 814-3867
From:
Matthew Adams matt...@matthewadams.me
To:
jdo-dev@db.apache.org
Cc:
tgallag...@mmm.com
Date:
11/03/2011 04:36 PM
Subject:
Re: New Feature Idea
Hi Tim,
We are in the process of standardizing similar functionality, called type
safe query, which is currently functional, albeit proprietary, in the JDO
RI, DataNucleus:
http://www.datanucleus.org/products/accessplatform/jdo/jdoql_typesafe.html
Check that out and see if it meets your needs.
-matthew
On Thu, Nov 3, 2011 at 5:21 PM, tgallag...@mmm.com wrote:
Hi,
I've been working the JDO for about 6 months now. Prior to that I was
accessing an RMDBs using a tool I created that built JavaBeans to
represent the DB tables and to manage those tables. I would then build
the
business logic on top of that. Using JDO will