You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Martin van den Bemt <ml...@mvdb.net> on 2005/11/05 15:16:36 UTC

[betwixt] strange behaviour with multimapping

Hi everyone,

We are using the betwixt multimapping in ddlutils but this gives some unexpected behaviour.
Let's assume this xml :

<database name="test">
   <index name="NotATable"/>
</database>

Let's assume this model :

Database -> Table -> Index

When reading this model we get a table named NotATable (index is not a child in anyway of database, 
table is though)

I tried to isolate this issue in a test for betwixt, but didn't succeed very wel, but I committed a 
test in ddlutils that shows this behaviour.

Below are all links to the files that may be necessary.

The test :

https://svn.apache.org/repos/asf/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDatabaseIO.java
(see the testmethod testFaultReadOfTable())

The mapping.xml :

https://svn.apache.org/repos/asf/db/ddlutils/trunk/src/java/mapping.xml

The DatabaseIO.java where the mapping is initialized :

https://svn.apache.org/repos/asf/db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DatabaseIO.java

The only thing I could figure out is in
https://svn.apache.org/repos/asf/jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/io/read/ReadContext.java
On line 287 it tries to get the elementDescriptor for elementName index and in
https://svn.apache.org/repos/asf/jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/ElementDescriptor.java
it the qualifiedname seems to be null, which makes it return the elementdescriptor for table, 
instead eg null and that way not processing that element at all.

Some changes in betwixt I tried didn't turn up anything (except for making the test that fails pass, 
but the rest failing :)

Any help is appreciated...

Mvgr,
Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [betwixt] strange behaviour with multimapping

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Sat, 2005-11-05 at 16:40 +0100, Martin van den Bemt wrote:
> Thanx Tom, you rock :)

+1

unfortunately, issues.apache.org is dead ATM :/

i'll try to take a look once it's back up again.

- robert



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [betwixt] strange behaviour with multimapping

Posted by Martin van den Bemt <ml...@mvdb.net>.
Thanx Tom, you rock :)

Mvgr,
Martin

Thomas Dudziak wrote:
> Hi,
> 
> I've created a bug report for it that contains a test case for it:
> 
> http://issues.apache.org/bugzilla/show_bug.cgi?id=37369
> 
> I think it has something to do with the fact that in (in the test
> case) the collection of class Element uses SubElement (for the updater
> method) which however is not contained in the mapping (only its
> subtypes are). This seems to confuse betwixt when reading the invalid
> XML.
> 
> Tom
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [betwixt] strange behaviour with multimapping

Posted by Thomas Dudziak <to...@gmail.com>.
On 11/11/05, robert burrell donkin <ro...@blueyonder.co.uk> wrote:

> that's strangely fitting: 'seeker of weird undreamt use cases' sounds
> like a dot bust job title for an alpha developer...

that would also fit for a couple of clients that I had over the years ...

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [betwixt] strange behaviour with multimapping

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Thu, 2005-11-10 at 22:13 +0100, Thomas Dudziak wrote:
> On 11/10/05, robert burrell donkin <ro...@blueyonder.co.uk> wrote:
> 
> > took me a long while to track down the best way to fix the problem (must
> > be getting old ;)
> 
> I don't think so, rather we're getting better all the time in finding
> the weirdest usage cases that nobody could ever have dreamed of ;-)

that's strangely fitting: 'seeker of weird undreamt use cases' sounds
like a dot bust job title for an alpha developer...

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [betwixt] strange behaviour with multimapping

Posted by Thomas Dudziak <to...@gmail.com>.
On 11/10/05, robert burrell donkin <ro...@blueyonder.co.uk> wrote:

> took me a long while to track down the best way to fix the problem (must
> be getting old ;)

I don't think so, rather we're getting better all the time in finding
the weirdest usage cases that nobody could ever have dreamed of ;-)

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [betwixt] strange behaviour with multimapping

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Thu, 2005-11-10 at 00:39 +0100, Thomas Dudziak wrote:
> On 11/7/05, robert burrell donkin <ro...@blueyonder.co.uk> wrote:
> 
> > it's the two stages of polymorphism which are confusing the engine. a
> > BeanBindAction is used for the mapping to allow a later potential
> > polymorphic match. however, no check is made that the name is
> > appropriate.
> >
> > betwixt needs to check that there is a polymorphic match either before
> > assigning the mapping action or upon instance creation. i need a little
> > time to think upon the right approach so i'll leave the fix till
> > tomorrow...
> 
> Thanks Robert! Works perfectly now :-)

i'm very glad to hear that!

took me a long while to track down the best way to fix the problem (must
be getting old ;)

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [betwixt] strange behaviour with multimapping

Posted by Thomas Dudziak <to...@gmail.com>.
On 11/7/05, robert burrell donkin <ro...@blueyonder.co.uk> wrote:

> it's the two stages of polymorphism which are confusing the engine. a
> BeanBindAction is used for the mapping to allow a later potential
> polymorphic match. however, no check is made that the name is
> appropriate.
>
> betwixt needs to check that there is a polymorphic match either before
> assigning the mapping action or upon instance creation. i need a little
> time to think upon the right approach so i'll leave the fix till
> tomorrow...

Thanks Robert! Works perfectly now :-)

regards,
Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [betwixt] strange behaviour with multimapping

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Sat, 2005-11-05 at 16:26 +0100, Thomas Dudziak wrote:
> Hi,
> 
> I've created a bug report for it that contains a test case for it:
> 
> http://issues.apache.org/bugzilla/show_bug.cgi?id=37369
> 
> I think it has something to do with the fact that in (in the test
> case) the collection of class Element uses SubElement (for the updater
> method) which however is not contained in the mapping (only its
> subtypes are). This seems to confuse betwixt when reading the invalid
> XML.

+1

it's the two stages of polymorphism which are confusing the engine. a
BeanBindAction is used for the mapping to allow a later potential
polymorphic match. however, no check is made that the name is
appropriate.

betwixt needs to check that there is a polymorphic match either before
assigning the mapping action or upon instance creation. i need a little
time to think upon the right approach so i'll leave the fix till
tomorrow... 

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [betwixt] strange behaviour with multimapping

Posted by Thomas Dudziak <to...@gmail.com>.
Hi,

I've created a bug report for it that contains a test case for it:

http://issues.apache.org/bugzilla/show_bug.cgi?id=37369

I think it has something to do with the fact that in (in the test
case) the collection of class Element uses SubElement (for the updater
method) which however is not contained in the mapping (only its
subtypes are). This seems to confuse betwixt when reading the invalid
XML.

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org