From 200a40b332420f94992eb39a6d0ea1cf1490ffc4 Mon Sep 17 00:00:00 2001 From: coreyg Date: Fri, 21 Nov 2014 09:30:19 +0000 Subject: Adding tuscany's website to their svn repo for svnpubsub git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1640879 13f79535-47bb-0310-9956-ffa450edef68 --- site/trunk/site-publish/rdb-das-java-faq.html | 202 ++++++++++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 site/trunk/site-publish/rdb-das-java-faq.html (limited to 'site/trunk/site-publish/rdb-das-java-faq.html') diff --git a/site/trunk/site-publish/rdb-das-java-faq.html b/site/trunk/site-publish/rdb-das-java-faq.html new file mode 100644 index 0000000000..9c8bf1c080 --- /dev/null +++ b/site/trunk/site-publish/rdb-das-java-faq.html @@ -0,0 +1,202 @@ + + + + + + + RDB DAS Java - FAQ : Apache Tuscany + + + + + + + + + + + + + + + + +
+ + + + +   + + + +
+ + +
+
+ + + + + + + +
+  Apache Tuscany > Home > DAS Overview > DAS Java Project > RDB DAS > RDB DAS Java - FAQ + + User List | Dev List | Issue Tracker   +
+ + + + + +
+
+ +
+
+
+ + + + +
Development
+ +

This page will contain frequently asked questions about RDB DAS. Please use the following template to further enhance this page.

+ +

How does DAS implement internal/external transaction management?

+ +

In DAS Config, element ConnectionInfo has a boolean attribute managedtx (default true).
+If it is true, DAS runtime manages transaction otherwise the caller is supposed to manage
+transaction.
+In cases, when the connection is externally passed (config file does not specify ConnectionInfo),
+the managedtx attribute default value ( true) is assumed.

+ + +

If two tables have a parent-child relationship but the query result set contains only columns from one table, does RDB DAS result DataGraph contain data from both parent and child table?

+ +

The RDB DAS will only populate a graph with data returned from the used query. If you want a
+graph that contains data from related tables then the query provided must return that data
+(typically a join). The relationship tests in the test suite demonstrate this.

+ +

If two tables have a parent-child relationship and the query result set contains columns from both tables, is the relationship analyzed by DAS when,

+
    +
  1. DAS Config explicitly defines relationship
  2. +
  3. DAS Config does not explicitly define relationship?
  4. +
+ + +

DAS supports some Convention over Configuration when it comes to supporting implied relationships.
+http://cwiki.apache.org/confluence/display/TUSCANY/ConventionOverConfiguration
+http://cwiki.apache.org/confluence/display/TUSCANY/ForeignKeyRepresentationAndManagement
+http://cwiki.apache.org/confluence/display/TUSCANY/WorkingWithRelationships
+Also, see test: ImpliedRelationshipTests.testAddNewOrder()

+ +

So, in summary, if the query has a where clause specifying the relationship, there is no need to
+have any relationship definition in config file as long as the column names (PK, FK) follow the
+naming conventions.

+ +

In the absence of naming conventions, the relationship needs to be explicitly defined in the config,
+so that the query result is mapped against it and the necessary result DataGraph is represented
+reflecting the relationship.

+ +

As DAS (and SDO) support disconnected processing of data, how does DAS achieve mapping between DataGraph properties and Database Metadata like table name, column name etc.?

+ +

DAS supports this mapping using DAS Config and in the absence of that using Convention over Configuration.
+http://cwiki.apache.org/confluence/display/TUSCANY/ConventionOverConfiguration. DataObject graph
+change summary contains old as well as modified values. Using this change summary and config/conventions DAS can support the necessary mapping.

+ +

Does DAS support working with tables that have no PK defined?

+ +

DAS mandates PK for any table, either specified in DAS Config or by following convention. In absence
+of both of these, DAS throws an error.

+ +

How does DAS support database generated keys?

+ +

This is supported for INSERT operation - either explicit insert (SQL INSERT statement as DAS command) or generated insert.
+In case of generated insert, the DAS config needs to have Column element having attribute "generated" set to "true". This attribute is not needed in case of explicit insert.
+In case of generated insert, "generated" attribute from Column element in Config is checked to form the appropriate insert statement. The jdbc supported PreparedStatement.getGeneratedKeys() is used to fetch the values being generated by the database. In case of generated insert, the value thus returned is set in DataGraph.

+ +

This feature is not supported on all versions of Oracle drivers, so DAS does not use this functionality if database is Oracle.

+ +

What manipulations does DAS provide for DataObjects?

+ +

DAS can get DataObject using Dynamic approach or Static approach. In Dynamic approach the query result set is used to form the DataObject. In static approach, DAS Config's DataObjectModel attribute needs a valid value, using which the DataObjects are created.
+For more details see http://cwiki.apache.org/confluence/display/TUSCANY/Graph+Merge.

+ +

When there is 1:n relationship between 2 tables, say Department:Employee, and there is a DataGraph with this relationship present, can one Employee DataObject from this graph be associated with 2 different Department DataObjects, using DAS Java Client? i.e. can 1:n relationship be changed to n:n using SDO?

+ +

No, when this is attempted, SDO maintains referential integrity. e.g.
+If you have a dept1 with emp1 and then execute:
+ dep2.getEmployees.add(emp1)
+the graph will automatically remove emp1 from dep1's list of employees and
+you are left with valid 1:m relationship.

+ +

What is Optimistic Concurrency Control?

+

See details on http://cwiki.apache.org/confluence/display/TUSCANY/OptimisticConcurrencyControl

+ +

By default OCC is ON. With this, in generated UPDATE statement, any column undergoing change also gets included in the WHERE clause.

+ +

Other than that, in DAS Config, in <Table> element , the <Column> element can have two boolean attributes:- managed(default true), collision

+ +

When collision=true for a column, during UPDATE statement generation, that column is included
+in the WHERE clause.

+ +

When managed=true for a column, during UPDATE statement generation, that column (needs to be BigDecimal) value is incremented by 1 and used in the SET clause in UPDATE.

+ +

managed=true, is effective only when collision=true, else managed attribute value is ignored.

+ +

What is the purpose of many and keyRestricted attributes in Relationship?

+ +

many=true allows for 1:n relationship. If it is false, it's 1:1 relationship. In case of 1:1 relationship, if keyRestricted is not specified, the link (relationship) between the parent and child rows can be broken, by setting the parentKeyTable's row to null/deleting the row. Also, a different parent row can be associated to the child row, which has one pre-existing parent row association. If keyRestricted=true, this kind on change in existing relationship is not allowed, user will get exception 'Can not modify a one to one relationship that is key restricted'.

+ +

In case of parent-child relationship, how to traverse back and forth?

+ +

If by Convention over Configuration/from DAS Config there is a name to a relationship, the opposite relationship is named with _opposite appended to it.

+ +

e.g. Consider two tables (CUSTOMER, ORDER) each with a PK named "ID". Also, ORDER has a FK named CUSTOMER_ID. The DAS recognizes this convention and assumes a one:many relationship between CUSTOMER and ORDER. In the fully dynamic case, a read of CUSTOMER and ORDER tables using a join will result in a graph of CUSTOMER DataObjects along with their related ORDERS.(name of relationship is ORDERS now.)

+ +

The property for the CUSTOMER Types list of ORDERs is named "ORDER" so:
+ DataObject order = cust.getDataObject("ORDER1");
+The name of the property in the ORDER Type that references the parent CUSTOMER, is
+ DataObject cust = order.getDataObject("CUSTOMER_opposite")

+ +

what is paging capability?

+ +

What is currently available in DAS is detailed on http://cwiki.apache.org/confluence/display/TUSCANY/WorkingWithPaging
+Other than sequential page access(pager.next(), pager.previous()), random access is also
+allowed using pager.getPage(number).

+
+
+
+
+
+ + + + + + + + \ No newline at end of file -- cgit v1.2.3