You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Harald Wellmann <Ha...@multi-m.de> on 2010/09/03 15:54:58 UTC

Confusing warning about openjpa.jdbc.SynchronizeMappings

Using OpenJPA 2.0.1 with automatic schema generation, I'm getting the
following warning:


The configuration property named "openjpa.jdbc.SynchronizeMappings" was not
recognized and will be ignored, although the name closely matches a valid
property called "openjpa.jdbc.SynchronizeMappings"


So the message is "X != X" - is that a known problem?

Best regards,

Harald
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Confusing-warning-about-openjpa-jdbc-SynchronizeMappings-tp5495438p5495438.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Confusing warning about openjpa.jdbc.SynchronizeMappings

Posted by Kevin Sutter <kw...@gmail.com>.
Very good input, Harald.  Thanks for your efforts.  I'll post this
information to the existing JIRA and we'll see if we can somebody to take a
look.  It would be great to get this one off the books.

Kevin

On Tue, Sep 7, 2010 at 1:44 PM, Harald Wellmann
<Ha...@multi-m.de>wrote:

>
> Hi Kevin,
>
> I can't offer a fix (yet), but I think I've pinpointed the problem. Here is
> a little test case:
>
> import static org.junit.Assert.assertEquals;
> import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;
> import org.junit.Test;
>
> public class ConfigurationTest {
>
>    @Test
>    public void cloneTest() {
>        JDBCConfigurationImpl config = new JDBCConfigurationImpl();
>        JDBCConfigurationImpl newConfig = (JDBCConfigurationImpl)
> config.clone();
>        assertEquals(config, newConfig);
>    }
> }
>
> The warning message about the configuration property
> openjpa.jdbc.SynchronizeMappings is logged during config.clone().
>
> clone() is implemented by invoking first toProperties(true) and then
> fromProperties() on the resulting properties map.
>
> fromProperties() removes all known properties from the map and then issues
> warnings for all remaining ones - at least that seems to be the intention.
>
> The problem is that SynchronizeMappings has no default value, or rather a
> default value of null. Thus, the map generated by toProperties(true)
> contains the key openjpa.jdbc.SynchronizeMappings with a value of null.
>
> fromProperties() in fact only removes the known properties with a non-null
> value,  so the key openjpa.jdbc.SynchronizeMappings remains in the map and
> causes the warning.
>
> The warning would not appear if clone() invoked toProperties(false), but
> I'm
> not sure if this has any side effects.
>
> Moreover, in my test case, the assertion
>
>   assertEquals(config, newConfig);
>
> fails - now the Javadoc of Object.clone() states that x.clone().equals(x)
> is
> not an absolute requirement (without giving any good reasons), but in this
> case I would definitely expect the clone of a configuration to be equal to
> the original.
>
> The assertion failure is caused by LockTimeout:0[int] !=
> LockTimeout:0[int],
> so it appears that for x of class IntValue the invariant
>
> x.clone().equals(x)
>
> does not hold either (why?).
>
> Incidentally, the comment of ConfigurationImpl.toProperties() is outdated.
> It references a non-existing parameter getAll and a non-existing method
> getAllProperties().
>
> Hopefully, this is enough input for someone familiar with the
> implementation
> details to come up with a fix...
>
> Best regards,
>
> Harald
>
>
>
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Confusing-warning-about-openjpa-jdbc-SynchronizeMappings-tp5495438p5507719.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: Confusing warning about openjpa.jdbc.SynchronizeMappings

Posted by Harald Wellmann <Ha...@multi-m.de>.
Hi Kevin,

I can't offer a fix (yet), but I think I've pinpointed the problem. Here is
a little test case:

import static org.junit.Assert.assertEquals;
import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;
import org.junit.Test;

public class ConfigurationTest {

    @Test
    public void cloneTest() {
        JDBCConfigurationImpl config = new JDBCConfigurationImpl();
        JDBCConfigurationImpl newConfig = (JDBCConfigurationImpl)
config.clone();
        assertEquals(config, newConfig);
    }
}

The warning message about the configuration property
openjpa.jdbc.SynchronizeMappings is logged during config.clone().

clone() is implemented by invoking first toProperties(true) and then
fromProperties() on the resulting properties map.

fromProperties() removes all known properties from the map and then issues
warnings for all remaining ones - at least that seems to be the intention.

The problem is that SynchronizeMappings has no default value, or rather a
default value of null. Thus, the map generated by toProperties(true)
contains the key openjpa.jdbc.SynchronizeMappings with a value of null.

fromProperties() in fact only removes the known properties with a non-null
value,  so the key openjpa.jdbc.SynchronizeMappings remains in the map and
causes the warning.

The warning would not appear if clone() invoked toProperties(false), but I'm
not sure if this has any side effects.

Moreover, in my test case, the assertion 

   assertEquals(config, newConfig);

fails - now the Javadoc of Object.clone() states that x.clone().equals(x) is
not an absolute requirement (without giving any good reasons), but in this
case I would definitely expect the clone of a configuration to be equal to
the original.

The assertion failure is caused by LockTimeout:0[int] != LockTimeout:0[int],
so it appears that for x of class IntValue the invariant 

x.clone().equals(x)

does not hold either (why?).

Incidentally, the comment of ConfigurationImpl.toProperties() is outdated.
It references a non-existing parameter getAll and a non-existing method
getAllProperties().

Hopefully, this is enough input for someone familiar with the implementation
details to come up with a fix...

Best regards,

Harald






-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Confusing-warning-about-openjpa-jdbc-SynchronizeMappings-tp5495438p5507719.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Confusing warning about openjpa.jdbc.SynchronizeMappings

Posted by Kevin Sutter <kw...@gmail.com>.
Hi Harald,
This issue has popped its ugly little head every once in a while.  It seems
to come and go as the seasons change.  The issue has most commonly been
raised with the OpenJPA.id property [1], but other properties have also been
detected.  The problem just hasn't received enough priority to fully debug
and resolve.  If you have the cycles, I'm sure the community would greatly
appreciate a fix for this...  :-)

Thanks,
Kevin

[1]  https://issues.apache.org/jira/browse/OPENJPA-428

On Fri, Sep 3, 2010 at 8:54 AM, Harald Wellmann
<Ha...@multi-m.de>wrote:

>
> Using OpenJPA 2.0.1 with automatic schema generation, I'm getting the
> following warning:
>
>
> The configuration property named "openjpa.jdbc.SynchronizeMappings" was not
> recognized and will be ignored, although the name closely matches a valid
> property called "openjpa.jdbc.SynchronizeMappings"
>
>
> So the message is "X != X" - is that a known problem?
>
> Best regards,
>
> Harald
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Confusing-warning-about-openjpa-jdbc-SynchronizeMappings-tp5495438p5495438.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>