Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » CDO 1.0 and 1 to many two way references
CDO 1.0 and 1 to many two way references [message #425764] Mon, 08 December 2008 13:04 Go to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
Hi,
I am working with:
CDO Version: 1.0.0.v200806180411, Build id: 200806180411.
EMF Version: 2.4.1.v200808251517, Build id: 200808251517
Eclipse Version: 3.4.1, Build id: M20080911-1700

I am using the vanilla EMF library example to test out what modifications
I will be required to make to distribute my EMF model. I have generated
under EMF 2.5 to use Dynamic Feature Delegation as elsewhere, otherwise I
have used the vanilla CDO generation technique.

In the model Book may have an Author reference to a single Writer. The
opposite of this reference is the books reference from Writer to Book,
which is unbounded. I start up a CDO Server ( I have a custom DDAdapter
“derby-client” to use a remote Derby connection, but otherwise the set up
is as set out in the CDO Wiki – shown below ). I then run two eclipse
workspaces using the same CDO Server. In Eclipse “A” I open resource
“liba” on Library A which has two writers “Byatt” and “Asimov”. In
Eclipse B I open resource “libb” on Library B which has two books
“Foundation” and “Possession”. In Eclipse A I add “Possession” to the
books of “Byatt”. In Eclipse B I set Book “Possession” 's author to
“Asimov”. I save Editor A then Editor B. Editor B shows the conflict on
Book “Possession” as expected. But Editor A shows both Asimov and Byatt as
having written Possession. I would have expected to see Editor B's
changes overwrite Editor A's changes, or for B's transaction to fail, as
it is in the database I can see both Writers having a relationship to the
same book.

My question is:

1)Is this what you would expect ( I could have a bug in my environment –
say the DerbyClientAdapter ), which is not generating the correct
constraints in the environment.
2)Is this just a bug with CDO 1.0 which is fixed with CDO 2.0 ( sorry, I
am setting up a source workspace at the moment). For example are the
correct constraints not being generated.
3)If not, is it a characteristic of the
org.eclipse.emf.cdo.server.internal.db.DBStore JDBC style implementation,
which does not constrain cardinality 1 relationships?
4)If I am not happy with this behaviour is it just a question of moving to
the Hibernate/Teneo based IDBStore and setting some params? Or is it some
deeper difference to how you see conflicts being handled?

Thanks


<?xml version="1.0" encoding="UTF-8"?>
<cdoServer>

<!--acceptor type="http"/ -->

<acceptor type="tcp" listenAddr="0.0.0.0" port="2036">
<!-- negotiator type="challenge" description="/temp/users.db"/ -->
</acceptor>

<repository name="repo1">
<property name="overrideUUID"
value="1ff5d226-b1f0-40fb-aba2-0c31b38c764f"/>
<property name="supportingAudits" value="true"/>
<property name="verifyingRevisions" value="false"/>
<property name="currentLRUCapacity" value="10000"/>
<property name="revisedLRUCapacity" value="100"/>

<store type="db">
<mappingStrategy type="horizontal">
<property name="qualifiedNames" value="false"/>
<property name="toManyReferences" value="ONE_TABLE_PER_REFERENCE"/>
<property name="toOneReferences" value="LIKE_ATTRIBUTES"/>
</mappingStrategy>

<jdbcDelegate type="statement" />
<!--<dbAdapter name="derby-embedded"/>
<dataSource class="org.apache.derby.jdbc.EmbeddedDataSource"
databaseName="/temp/cdodb1"
createDatabase="create"/>
-->



<dbAdapter name="derby-client"/>
<dataSource class="org.apache.derby.jdbc.ClientDataSource"
url="jdbc:derby://localhost:1527/cdoTest"
databaseName="cdoTest1"
user="user1"
password="user1"
createDatabase="create"/>

<!--<dbAdapter name="hsqldb"/>
<dataSource class="org.eclipse.net4j.db.hsqldb.HSQLDBDataSource"
database="jdbc:hsqldb:mem:cdodb1"
user="sa"/>-->

<!--<dbAdapter name="mysql"/>
<dataSource class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
url="jdbc:mysql://localhost/cdodb1"
user="sa"/>-->

<!--<dbAdapter name="postgresql"/>
<dataSource class="org.postgresql.ds.PGSimpleDataSource"
url="jdbc:postgresql://localhost:5432/cdo"
databaseName="cdo"
user="cdo"
password="cdo"/>-->
</store>
</repository>

</cdoServer>

DBAdapter impl;

/*
Source adapted from org.eclipse.net4j.db.internal.derby.DerbyAdapter from
net4j plugins
*/
import java.sql.Driver;

import javax.sql.DataSource;

import org.apache.derby.jdbc.ClientDataSource;
import org.apache.derby.jdbc.ClientDriver;
import org.eclipse.net4j.db.DBType;
import org.eclipse.net4j.db.ddl.IDBField;
import org.eclipse.net4j.spi.db.DBAdapter;

public class DerbyClientAdapter extends DBAdapter
{
public static final String VERSION = "1.0.0.0";

private static final String[] RESERVED_WORDS = { "ADD", "ALL",
"ALLOCATE", "ALTER", "AND", "ANY", "ARE", "AS", "ASC",
"ASSERTION", "AT", "AUTHORIZATION", "AVG", "BEGIN", "BETWEEN",
"BIGINT", "BIT", "BOOLEAN", "BOTH", "BY", "CALL",
"CASCADE", "CASCADED", "CASE", "CAST", "CHAR", "CHARACTER",
"CHECK", "CLOSE", "COALESCE", "COLLATE", "COLLATION",
"COLUMN", "COMMIT", "CONNECT", "CONNECTION", "CONSTRAINT",
"CONSTRAINTS", "CONTINUE", "CONVERT", "CORRESPONDING",
"CREATE", "CURRENT", "CURRENT_DATE", "CURRENT_TIME",
"CURRENT_TIMESTAMP", "CURRENT_USER", "CURSOR", "DEALLOCATE",
"DEC", "DECIMAL", "DECLARE", "DEFAULT", "DEFERRABLE", "DEFERRED",
"DELETE", "DESC", "DESCRIBE", "DIAGNOSTICS",
"DISCONNECT", "DISTINCT", "DOUBLE", "DROP", "ELSE", "END",
"END-EXEC", "ESCAPE", "EXCEPT", "EXCEPTION", "EXEC",
"EXECUTE", "EXISTS", "EXPLAIN", "EXTERNAL", "FALSE", "FETCH",
"FIRST", "FLOAT", "FOR", "FOREIGN", "FOUND",
"FROM", "FULL", "FUNCTION", "GET", "GETCURRENTCONNECTION",
"GLOBAL", "GO", "GOTO", "GRANT", "GROUP", "HAVING",
"HOUR", "IDENTITY", "IMMEDIATE", "IN", "INDICATOR", "INITIALLY",
"INNER", "INOUT", "INPUT", "INSENSITIVE",
"INSERT", "INT", "INTEGER", "INTERSECT", "INTO", "IS", "ISOLATION",
"JOIN", "KEY", "LAST", "LEFT", "LIKE",
"LOWER", "LTRIM", "MATCH", "MAX", "MIN", "MINUTE", "NATIONAL",
"NATURAL", "NCHAR", "NVARCHAR", "NEXT", "NO",
"NOT", "NULL", "NULLIF", "NUMERIC", "OF", "ON", "ONLY", "OPEN",
"OPTION", "OR", "ORDER", "OUTER", "OUTPUT",
"OVERLAPS", "PAD", "PARTIAL", "PREPARE", "PRESERVE", "PRIMARY",
"PRIOR", "PRIVILEGES", "PROCEDURE", "PUBLIC",
"READ", "REAL", "REFERENCES", "RELATIVE", "RESTRICT", "REVOKE",
"RIGHT", "ROLLBACK", "ROWS", "RTRIM", "SCHEMA",
"SCROLL", "SECOND", "SELECT", "SESSION_USER", "SET", "SMALLINT",
"SOME", "SPACE", "SQL", "SQLCODE", "SQLERROR",
"SQLSTATE", "SUBSTR", "SUBSTRING", "SUM", "SYSTEM_USER", "TABLE",
"TEMPORARY", "TIMEZONE_HOUR",
"TIMEZONE_MINUTE", "TO", "TRANSACTION", "TRANSLATE", "TRANSLATION",
"TRIM", "TRUE", "UNION", "UNIQUE", "UNKNOWN",
"UPDATE", "UPPER", "USER", "USING", "VALUES", "VARCHAR", "VARYING",
"VIEW", "WHENEVER", "WHERE", "WITH", "WORK",
"WRITE", "XML", "XMLEXISTS", "XMLPARSE", "XMLQUERY",
"XMLSERIALIZE", "YEAR" };


public static final String NAME = "derby-client";

public DerbyClientAdapter()
{
super(NAME, VERSION);
}

@Override
protected String getTypeName(IDBField field)
{
DBType type = field.getType();
switch (type)
{
case TINYINT:
case BOOLEAN:
case BIT:
return "SMALLINT";

case LONGVARBINARY:
case VARBINARY:
case BINARY:
return "BLOB";
}

return super.getTypeName(field);
}

@Override
public void appendValue(StringBuilder builder, IDBField field, Object
value)
{
if (value instanceof Boolean)
{
value = (Boolean)value ? 1 : 0;
}

super.appendValue(builder, field, value);
}

public String[] getReservedWords()
{
return RESERVED_WORDS;
}
public Driver getJDBCDriver()
{
return new ClientDriver();
}

public DataSource createJDBCDataSource()
{
return new ClientDataSource();
}

}
Re: CDO 1.0 and 1 to many two way references [message #425774 is a reply to message #425764] Mon, 08 December 2008 15:38 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
JF wrote:
> Hi,
> I am working with:
> CDO Version: 1.0.0.v200806180411, Build id: 200806180411.
> EMF Version: 2.4.1.v200808251517, Build id: 200808251517
> Eclipse Version: 3.4.1, Build id: M20080911-1700
>
> I am using the vanilla EMF library example to test out what
> modifications I will be required to make to distribute my EMF model. I
> have generated under EMF 2.5 to use Dynamic Feature Delegation as
> elsewhere, otherwise I have used the vanilla CDO generation technique.
>
> In the model Book may have an Author reference to a single Writer.
> The opposite of this reference is the books reference from Writer to
> Book, which is unbounded. I start up a CDO Server ( I have a custom
> DDAdapter �derby-client� to use a remote Derby connection, but otherwise
> the set up is as set out in the CDO Wiki � shown below ). I then run two
> eclipse workspaces using the same CDO Server. In Eclipse �A� I open
> resource �liba� on Library A which has two writers �Byatt� and
> �Asimov�. In Eclipse B I open resource �libb� on Library B which has two
> books �Foundation� and �Possession�. In Eclipse A I add �Possession� to
> the books of �Byatt�. In Eclipse B I set Book �Possession� 's author to
> �Asimov�. I save Editor A then Editor B. Editor B shows the conflict on
> Book �Possession� as expected. But Editor A shows both Asimov and Byatt
> as having written Possession. I would have expected to see Editor B's
> changes overwrite Editor A's changes, or for B's transaction to fail, as
> it is in the database I can see both Writers having a relationship to
> the same book.
>
> My question is:
>
> 1)Is this what you would expect ( I could have a bug in my environment �
> say the DerbyClientAdapter ), which is not generating the correct
> constraints in the environment.
EclipseB should failed at commit time. Then only ByAtt->Possession
should be visible in eclipseA.
I tried it with 1.0.4 and here the behavior I have.
When I commit EclipseA I see conflict in EclipseB.

When I try to commit EclipseB.. it failed.. then I have the choice of
local rollback and remote rollback.. Did you have this popup yourself.

From there the changes are rolled back. So I'm not able to reprouce
your behavior based on what I did (I used category as my example).


> 2)Is this just a bug with CDO 1.0 which is fixed with CDO 2.0 ( sorry, I
> am setting up a source workspace at the moment). For example are the
> correct constraints not being generated.
If you could check if this occured in 2.0 or in 10.4 it will be great.
We did some changes at the back-end(2.0.0) and for 1.0 as well so it
could have been fixes.

> 3)If not, is it a characteristic of the
> org.eclipse.emf.cdo.server.internal.db.DBStore JDBC style
> implementation, which does not constrain cardinality 1 relationships?
no (don't think so)

> 4)If I am not happy with this behaviour is it just a question of moving
> to the Hibernate/Teneo based IDBStore and setting some params? Or is it
> some deeper difference to how you see conflicts being handled?
I don't believed it is a problem with Derby.

>
> Thanks
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <cdoServer>
>
> <!--acceptor type="http"/ -->
>
> <acceptor type="tcp" listenAddr="0.0.0.0" port="2036">
> <!-- negotiator type="challenge" description="/temp/users.db"/ -->
> </acceptor>
>
> <repository name="repo1">
> <property name="overrideUUID"
> value="1ff5d226-b1f0-40fb-aba2-0c31b38c764f"/>
> <property name="supportingAudits" value="true"/>
> <property name="verifyingRevisions" value="false"/>
> <property name="currentLRUCapacity" value="10000"/>
> <property name="revisedLRUCapacity" value="100"/>
>
> <store type="db">
> <mappingStrategy type="horizontal">
> <property name="qualifiedNames" value="false"/>
> <property name="toManyReferences"
> value="ONE_TABLE_PER_REFERENCE"/>
> <property name="toOneReferences" value="LIKE_ATTRIBUTES"/>
> </mappingStrategy>
>
> <jdbcDelegate type="statement" />
> <!--<dbAdapter name="derby-embedded"/>
> <dataSource class="org.apache.derby.jdbc.EmbeddedDataSource"
> databaseName="/temp/cdodb1"
> createDatabase="create"/>
> -->
>
>
>
> <dbAdapter name="derby-client"/>
> <dataSource class="org.apache.derby.jdbc.ClientDataSource"
> url="jdbc:derby://localhost:1527/cdoTest"
> databaseName="cdoTest1"
> user="user1"
> password="user1"
> createDatabase="create"/>
>
> <!--<dbAdapter name="hsqldb"/>
> <dataSource
> class="org.eclipse.net4j.db.hsqldb.HSQLDBDataSource"
> database="jdbc:hsqldb:mem:cdodb1"
> user="sa"/>-->
>
> <!--<dbAdapter name="mysql"/>
> <dataSource
> class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
> url="jdbc:mysql://localhost/cdodb1"
> user="sa"/>-->
>
> <!--<dbAdapter name="postgresql"/>
> <dataSource class="org.postgresql.ds.PGSimpleDataSource"
> url="jdbc:postgresql://localhost:5432/cdo"
> databaseName="cdo"
> user="cdo"
> password="cdo"/>-->
> </store>
> </repository>
>
> </cdoServer>
>
> DBAdapter impl;
>
> /*
> Source adapted from org.eclipse.net4j.db.internal.derby.DerbyAdapter
> from net4j plugins
> */
> import java.sql.Driver;
>
> import javax.sql.DataSource;
>
> import org.apache.derby.jdbc.ClientDataSource;
> import org.apache.derby.jdbc.ClientDriver;
> import org.eclipse.net4j.db.DBType;
> import org.eclipse.net4j.db.ddl.IDBField;
> import org.eclipse.net4j.spi.db.DBAdapter;
>
> public class DerbyClientAdapter extends DBAdapter
> {
> public static final String VERSION = "1.0.0.0";
>
> private static final String[] RESERVED_WORDS = { "ADD", "ALL",
> "ALLOCATE", "ALTER", "AND", "ANY", "ARE", "AS", "ASC",
> "ASSERTION", "AT", "AUTHORIZATION", "AVG", "BEGIN", "BETWEEN",
> "BIGINT", "BIT", "BOOLEAN", "BOTH", "BY", "CALL",
> "CASCADE", "CASCADED", "CASE", "CAST", "CHAR", "CHARACTER",
> "CHECK", "CLOSE", "COALESCE", "COLLATE", "COLLATION",
> "COLUMN", "COMMIT", "CONNECT", "CONNECTION", "CONSTRAINT",
> "CONSTRAINTS", "CONTINUE", "CONVERT", "CORRESPONDING",
> "CREATE", "CURRENT", "CURRENT_DATE", "CURRENT_TIME",
> "CURRENT_TIMESTAMP", "CURRENT_USER", "CURSOR", "DEALLOCATE",
> "DEC", "DECIMAL", "DECLARE", "DEFAULT", "DEFERRABLE",
> "DEFERRED", "DELETE", "DESC", "DESCRIBE", "DIAGNOSTICS",
> "DISCONNECT", "DISTINCT", "DOUBLE", "DROP", "ELSE", "END",
> "END-EXEC", "ESCAPE", "EXCEPT", "EXCEPTION", "EXEC",
> "EXECUTE", "EXISTS", "EXPLAIN", "EXTERNAL", "FALSE", "FETCH",
> "FIRST", "FLOAT", "FOR", "FOREIGN", "FOUND",
> "FROM", "FULL", "FUNCTION", "GET", "GETCURRENTCONNECTION",
> "GLOBAL", "GO", "GOTO", "GRANT", "GROUP", "HAVING",
> "HOUR", "IDENTITY", "IMMEDIATE", "IN", "INDICATOR",
> "INITIALLY", "INNER", "INOUT", "INPUT", "INSENSITIVE",
> "INSERT", "INT", "INTEGER", "INTERSECT", "INTO", "IS",
> "ISOLATION", "JOIN", "KEY", "LAST", "LEFT", "LIKE",
> "LOWER", "LTRIM", "MATCH", "MAX", "MIN", "MINUTE", "NATIONAL",
> "NATURAL", "NCHAR", "NVARCHAR", "NEXT", "NO",
> "NOT", "NULL", "NULLIF", "NUMERIC", "OF", "ON", "ONLY",
> "OPEN", "OPTION", "OR", "ORDER", "OUTER", "OUTPUT",
> "OVERLAPS", "PAD", "PARTIAL", "PREPARE", "PRESERVE",
> "PRIMARY", "PRIOR", "PRIVILEGES", "PROCEDURE", "PUBLIC",
> "READ", "REAL", "REFERENCES", "RELATIVE", "RESTRICT",
> "REVOKE", "RIGHT", "ROLLBACK", "ROWS", "RTRIM", "SCHEMA",
> "SCROLL", "SECOND", "SELECT", "SESSION_USER", "SET",
> "SMALLINT", "SOME", "SPACE", "SQL", "SQLCODE", "SQLERROR",
> "SQLSTATE", "SUBSTR", "SUBSTRING", "SUM", "SYSTEM_USER",
> "TABLE", "TEMPORARY", "TIMEZONE_HOUR",
> "TIMEZONE_MINUTE", "TO", "TRANSACTION", "TRANSLATE",
> "TRANSLATION", "TRIM", "TRUE", "UNION", "UNIQUE", "UNKNOWN",
> "UPDATE", "UPPER", "USER", "USING", "VALUES", "VARCHAR",
> "VARYING", "VIEW", "WHENEVER", "WHERE", "WITH", "WORK",
> "WRITE", "XML", "XMLEXISTS", "XMLPARSE", "XMLQUERY",
> "XMLSERIALIZE", "YEAR" };
>
> public static final String NAME = "derby-client";
>
> public DerbyClientAdapter()
> {
> super(NAME, VERSION);
> }
>
> @Override
> protected String getTypeName(IDBField field)
> {
> DBType type = field.getType();
> switch (type)
> {
> case TINYINT:
> case BOOLEAN:
> case BIT:
> return "SMALLINT";
>
> case LONGVARBINARY:
> case VARBINARY:
> case BINARY:
> return "BLOB";
> }
>
> return super.getTypeName(field);
> }
>
> @Override
> public void appendValue(StringBuilder builder, IDBField field,
> Object value)
> {
> if (value instanceof Boolean)
> {
> value = (Boolean)value ? 1 : 0;
> }
>
> super.appendValue(builder, field, value);
> }
>
> public String[] getReservedWords()
> {
> return RESERVED_WORDS;
> }
> public Driver getJDBCDriver()
> {
> return new ClientDriver();
> }
>
> public DataSource createJDBCDataSource()
> {
> return new ClientDataSource();
> }
>
> }
>
>
Re: CDO 1.0 and 1 to many two way references [message #425813 is a reply to message #425774] Tue, 09 December 2008 10:04 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
Thanks Simon,

I have updated to CDO 1.0.4, and am still having the same problem.
However it may still be in modifications I have made; for example the
Dynamic Feature stuff (generated under EMF 2.5 but run under EMF 2.4), so
I am going to test a more vanilla library example.
When you said you tested with Category, was that a different example from
the library one? It could help me track down my problem...
Re: CDO 1.0 and 1 to many two way references [message #425820 is a reply to message #425813] Tue, 09 December 2008 12:13 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
Okay, I tried this with CDO 1.0.4 and the CDO example shown at
http://wiki.eclipse.org/Preparing_EMF_Models_for_CDO#Generat e_The_Model. I
cut and pasted the code from the Wiki, altered the name, nsURI, and prefix
of the EPackage for good measure and generated for CDO as described in the
CDO Wiki. I generated Model, Edit and Editor.

I dropped the DB and started from scratch.
I started up two Eclipse Apps pointing at the same CDO Server.
Using the CDO Sessions GUI;

In Eclipse A I created a Session and registered the newly generated CDO
Model ( as above )
I added a resource /companya and added a new Compnay A at the root with a
Category "Famous". I added two products, GizmoA and WidgetB.
I added a resource /ordersb and added a new Order to the root. I added an
OrderDetail and set the price to 1.0.0.
I saved the edits in /companya, which of course also saves the edits in
/ordersb?

In Eclipse B I then opened a Session on the same CDO Server and loaded the
resources /companya and /ordersb.

In Eclipse A i closed the /ordersb Editor.
In Eclipse B i closed the /companya Editor.

In Eclipse A I edited orders details of Gizmo A to contain Order Detail
1.0 from /ordersb.
In Eclipse B I edited the product of Order Detail 1.0 to be WidgetB.

I save Editor A, and Editor B shows conflict.
I try to save Editor B but get no dialogs or errors.

In Editor A both WidgetB and GizmoA show the Order Detail 1.0 in their
order details.

Do you get this problem? Note that Product<->Order Detail is a two way
reference but NOT a containment ( Category seems only to have containments
.. )


I'll try it with an Embedded Derby DB next, and then CDO 2.0 using the
source workspace.
Re: CDO 1.0 and 1 to many two way references [message #425821 is a reply to message #425820] Tue, 09 December 2008 13:07 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
JF,

It sounds a bit like:

223722: [UI] No Commit Failure Dialog
https://bugs.eclipse.org/bugs/show_bug.cgi?id=223722

Cheers
/Eike

----
http://thegordian.blogspot.com



JF schrieb:
> Okay, I tried this with CDO 1.0.4 and the CDO example shown at
> http://wiki.eclipse.org/Preparing_EMF_Models_for_CDO#Generat e_The_Model.
> I cut and pasted the code from the Wiki, altered the name, nsURI, and
> prefix of the EPackage for good measure and generated for CDO as
> described in the CDO Wiki. I generated Model, Edit and Editor.
>
> I dropped the DB and started from scratch. I started up two Eclipse
> Apps pointing at the same CDO Server.
> Using the CDO Sessions GUI;
>
> In Eclipse A I created a Session and registered the newly generated
> CDO Model ( as above )
> I added a resource /companya and added a new Compnay A at the root
> with a Category "Famous". I added two products, GizmoA and WidgetB. I
> added a resource /ordersb and added a new Order to the root. I added
> an OrderDetail and set the price to 1.0.0.
> I saved the edits in /companya, which of course also saves the edits
> in /ordersb?
>
> In Eclipse B I then opened a Session on the same CDO Server and loaded
> the resources /companya and /ordersb.
>
> In Eclipse A i closed the /ordersb Editor.
> In Eclipse B i closed the /companya Editor.
>
> In Eclipse A I edited orders details of Gizmo A to contain Order
> Detail 1.0 from /ordersb.
> In Eclipse B I edited the product of Order Detail 1.0 to be WidgetB.
>
> I save Editor A, and Editor B shows conflict.
> I try to save Editor B but get no dialogs or errors.
>
> In Editor A both WidgetB and GizmoA show the Order Detail 1.0 in their
> order details.
>
> Do you get this problem? Note that Product<->Order Detail is a two way
> reference but NOT a containment ( Category seems only to have
> containments .. )
>
>
> I'll try it with an Embedded Derby DB next, and then CDO 2.0 using the
> source workspace.
>
>


Re: CDO 1.0 and 1 to many two way references [message #425841 is a reply to message #425820] Tue, 09 December 2008 20:40 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
JF wrote:
> Okay, I tried this with CDO 1.0.4 and the CDO example shown at
> http://wiki.eclipse.org/Preparing_EMF_Models_for_CDO#Generat e_The_Model.
> I cut and pasted the code from the Wiki, altered the name, nsURI, and
> prefix of the EPackage for good measure and generated for CDO as
> described in the CDO Wiki. I generated Model, Edit and Editor.
>
> I dropped the DB and started from scratch. I started up two Eclipse Apps
> pointing at the same CDO Server.
> Using the CDO Sessions GUI;
>
> In Eclipse A I created a Session and registered the newly generated CDO
> Model ( as above )
> I added a resource /companya and added a new Compnay A at the root with
> a Category "Famous". I added two products, GizmoA and WidgetB. I added a
> resource /ordersb and added a new Order to the root. I added an
> OrderDetail and set the price to 1.0.0.
> I saved the edits in /companya, which of course also saves the edits in
> /ordersb?
>
> In Eclipse B I then opened a Session on the same CDO Server and loaded
> the resources /companya and /ordersb.
>
> In Eclipse A i closed the /ordersb Editor.
> In Eclipse B i closed the /companya Editor.
>
> In Eclipse A I edited orders details of Gizmo A to contain Order Detail
> 1.0 from /ordersb.
> In Eclipse B I edited the product of Order Detail 1.0 to be WidgetB.
>
> I save Editor A, and Editor B shows conflict.
> I try to save Editor B but get no dialogs or errors.

Humm.. how come i have one ?
>
> In Editor A both WidgetB and GizmoA show the Order Detail 1.0 in their
> order details.
>
> Do you get this problem? Note that Product<->Order Detail is a two way
> reference but NOT a containment ( Category seems only to have
> containments . )
>
>
> I'll try it with an Embedded Derby DB next, and then CDO 2.0 using the
> source workspace.
>
>
Let me know the result!!!

Simon
Re: CDO 1.0 and 1 to many two way references [message #425860 is a reply to message #425841] Wed, 10 December 2008 09:59 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
It could be a problem with my net4j install. I updated to CDO 1.0.4 using
p2 and the EMF interim update sites. There seems to be no Net4j 1.0.4
there. Is this a case of having to do a kludge by putting the stuff in
dropins?
Re: CDO 1.0 and 1 to many two way references [message #425866 is a reply to message #425860] Wed, 10 December 2008 12:43 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
Tried putting the Net4j 1.0.4 in dropins e.g. dropins/NET4J104/eclipse
etc... but its not picking up any of the new features....
Re: CDO 1.0 and 1 to many two way references [message #425867 is a reply to message #425866] Wed, 10 December 2008 14:04 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
Got P2 to load net4j 1.0.4. still no dialog showing error during
transaction commit.
Re: CDO 1.0 and 1 to many two way references [message #425868 is a reply to message #425867] Wed, 10 December 2008 14:42 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
I traced through the CDOTransactionImpl commit;

public void commit() throws TransactionException
{
if (dirty)
{
if (TRACER.isEnabled())
{
TRACER.trace("commit()");
}

for (CDOTransactionHandler handler : getHandlers())
{
handler.committingTransaction(this);
}

try
{
newPackages = analyzeNewPackages();

preCommit(newObjects);
preCommit(dirtyObjects);

CDOSessionImpl session = getSession();
IChannel channel = session.getChannel();
IFailOverStrategy failOverStrategy = session.getFailOverStrategy();
CommitTransactionRequest request = new
CommitTransactionRequest(channel, this);

CommitTransactionResult result = failOverStrategy.send(request,
commitTimeout);
String rollbackMessage = result.getRollbackMessage();
if (rollbackMessage != null)
{
throw new TransactionException(rollbackMessage);
}

postCommit(newResources, result);
postCommit(newObjects, result);
postCommit(dirtyObjects, result);

for (CDOPackage newPackage : newPackages)
{
((InternalCDOPackage)newPackage).setPersistent(true);
}

if (!dirtyObjects.isEmpty())
{
Set<CDOIDAndVersion> dirtyIDs = new HashSet<CDOIDAndVersion>();
for (CDOObject dirtyObject : dirtyObjects.values())
{
CDORevision revision = dirtyObject.cdoRevision();
CDOIDAndVersion dirtyID =
CDOIDUtil.createIDAndVersion(revision.getID(), revision.getVersion());
dirtyIDs.add(dirtyID);
}

session.notifyInvalidation(result.getTimeStamp(), dirtyIDs,
this);
}

cleanUp();
Map<CDOIDTemp, CDOID> idMappings = result.getIDMappings();
fireEvent(new
FinishedEvent(CDOTransactionFinishedEvent.Type.COMMITTED, idMappings));
}
catch (RuntimeException ex)
{
throw ex;
}
catch (Exception ex)
{
throw new TransactionException(ex);
}
}
}

CommitTransactionResult result has no rollback message ("String
rollbackMessage = result.getRollbackMessage();"). I am not gettiung
anything like this back from the server, in the case of Editor B trying to
save its conflict changes. Should I be seeing one, or is the exception
thrown by some other part?
Re: CDO 1.0 and 1 to many two way references [message #425869 is a reply to message #425868] Wed, 10 December 2008 14:45 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
JF,

The conflict state of the transaction is locally ignored.
I think we need to fix it in both branches:

223722: [UI] No Commit Failure Dialog
https://bugs.eclipse.org/bugs/show_bug.cgi?id=223722

Cheers
/Eike

----
http://thegordian.blogspot.com


JF schrieb:
> I traced through the CDOTransactionImpl commit;
>
> public void commit() throws TransactionException
> {
> if (dirty)
> {
> if (TRACER.isEnabled())
> {
> TRACER.trace("commit()");
> }
>
> for (CDOTransactionHandler handler : getHandlers())
> {
> handler.committingTransaction(this);
> }
>
> try
> {
> newPackages = analyzeNewPackages();
>
> preCommit(newObjects);
> preCommit(dirtyObjects);
>
> CDOSessionImpl session = getSession();
> IChannel channel = session.getChannel();
> IFailOverStrategy failOverStrategy =
> session.getFailOverStrategy();
> CommitTransactionRequest request = new
> CommitTransactionRequest(channel, this);
>
> CommitTransactionResult result = failOverStrategy.send(request,
> commitTimeout);
> String rollbackMessage = result.getRollbackMessage();
> if (rollbackMessage != null)
> {
> throw new TransactionException(rollbackMessage);
> }
>
> postCommit(newResources, result);
> postCommit(newObjects, result);
> postCommit(dirtyObjects, result);
>
> for (CDOPackage newPackage : newPackages)
> {
> ((InternalCDOPackage)newPackage).setPersistent(true);
> }
>
> if (!dirtyObjects.isEmpty())
> {
> Set<CDOIDAndVersion> dirtyIDs = new HashSet<CDOIDAndVersion>();
> for (CDOObject dirtyObject : dirtyObjects.values())
> {
> CDORevision revision = dirtyObject.cdoRevision();
> CDOIDAndVersion dirtyID =
> CDOIDUtil.createIDAndVersion(revision.getID(), revision.getVersion());
> dirtyIDs.add(dirtyID);
> }
>
> session.notifyInvalidation(result.getTimeStamp(), dirtyIDs,
> this);
> }
>
> cleanUp();
> Map<CDOIDTemp, CDOID> idMappings = result.getIDMappings();
> fireEvent(new
> FinishedEvent(CDOTransactionFinishedEvent.Type.COMMITTED, idMappings));
> }
> catch (RuntimeException ex)
> {
> throw ex;
> }
> catch (Exception ex)
> {
> throw new TransactionException(ex);
> }
> }
> }
>
> CommitTransactionResult result has no rollback message ("String
> rollbackMessage = result.getRollbackMessage();"). I am not gettiung
> anything like this back from the server, in the case of Editor B
> trying to save its conflict changes. Should I be seeing one, or is the
> exception thrown by some other part?
>
>


Previous Topic:[Teneo] Mixing dynamicly generated mapping along with static xml
Next Topic:Reflective API (eSet) in multiple (parent/child) models
Goto Forum:
  


Current Time: Fri Mar 29 05:46:38 GMT 2024

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

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

Back to the top