You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Stephen Cameron <st...@gmail.com> on 2016/08/17 02:24:00 UTC

Redefining schema name in config file (to override JDO class annotation setting)

Hi,

I am using the security module which defines a schema 'isissecurity', but
in MySQL the security tables get created in the default schema. Everything
works fine, but I still get an error message at startup which I'd like to
get rid of.

I'm pretty sure I've seen reference to a means to remap the schema name via
a Datanucleus configuration (persistence.xml?), if someone could show me
how this is done, or point me to relevant documentation that would be
appreciated.

Thanks
Steve Cameron

Re: Redefining schema name in config file (to override JDO class annotation setting)

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 25 August 2016 at 08:14, Andy Jefferson <an...@datanucleus.org> wrote:

> >
> > So, it looks like DataNucleus will merge any XML metadata with any
> > annotations (with the XML metadata taking preference).  In other words,
> > exactly what we want.  (Andy, if you pick this up, any
> > comments/corrections?)
>
> JDO standard metadata mechanism is as you describe, see
>
> http://www.datanucleus.org/products/accessplatform_5_0/jdo/metadata.html
>
> which gives order or priority of the different metadata input types. The
> merging process is not perfect but tries to handle all common situations.
>
>
> Regards
> --
> Andy
> DataNucleus (Web: http://www.datanucleus.org   Twitter: @datanucleus)
>


Many thanks for confirming that, Andy.

Dan

Re: Redefining schema name in config file (to override JDO class annotation setting)

Posted by Andy Jefferson <an...@datanucleus.org>.
> What I've found is that by adding a file SimpleObject.jdo (in the
> domainapp/dom/simple package, right alongside SimpleObject.java), with the
> contents:
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <jdo xmlns="http://xmlns.jcp.org/xml/ns/jdo/jdo"
>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>      xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/jdo/jdo
>         http://xmlns.jcp.org/xml/ns/jdo/jdo_3_0.xsd">
> 
>     <package name="domainapp.dom.simple">
>         <class name="SimpleObject"
>                schema="simpleXX">
>         </class>
>     </package>
> </jdo>
> 
> then this was enough to change the schema.  (If you try to repeat this
> test, note that the SimpleObjectTeardown fixture also needs to be changed
> to reference the different schema).
> 
> When I went to download the JDO metadata before-and-after the change (on
> the metadata panel), the only difference is this change in schema.
> 
> So, it looks like DataNucleus will merge any XML metadata with any
> annotations (with the XML metadata taking preference).  In other words,
> exactly what we want.  (Andy, if you pick this up, any
> comments/corrections?)

JDO standard metadata mechanism is as you describe, see

http://www.datanucleus.org/products/accessplatform_5_0/jdo/metadata.html

which gives order or priority of the different metadata input types. The merging process is not perfect but tries to handle all common situations.


Regards
-- 
Andy
DataNucleus (Web: http://www.datanucleus.org   Twitter: @datanucleus)

Re: Redefining schema name in config file (to override JDO class annotation setting)

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Steve (and Oscar)

Just been playing around with this using the simpleapp.

What I've found is that by adding a file SimpleObject.jdo (in the
domainapp/dom/simple package, right alongside SimpleObject.java), with the
contents:


<?xml version="1.0" encoding="UTF-8" ?>
<jdo xmlns="http://xmlns.jcp.org/xml/ns/jdo/jdo"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/jdo/jdo
        http://xmlns.jcp.org/xml/ns/jdo/jdo_3_0.xsd">

    <package name="domainapp.dom.simple">
        <class name="SimpleObject"
               schema="simpleXX">
        </class>
    </package>
</jdo>

then this was enough to change the schema.  (If you try to repeat this
test, note that the SimpleObjectTeardown fixture also needs to be changed
to reference the different schema).

When I went to download the JDO metadata before-and-after the change (on
the metadata panel), the only difference is this change in schema.

So, it looks like DataNucleus will merge any XML metadata with any
annotations (with the XML metadata taking preference).  In other words,
exactly what we want.  (Andy, if you pick this up, any
comments/corrections?)

Let me know if this works for you, too.

Thanks.
Dan





2016-08-22 15:13 GMT+01:00 Óscar Bou - GOVERTIS <o....@govertis.com>:

> Hi Stephen,
>
> Found Dan’s comment on a issue on github which details how to override it
> with “package.jdo” in META-INF:
>
> https://github.com/isisaddons/isis-module-security/issues/35
>
>
> HTH,
>
> Oscar
>
>
> El 17 ago 2016, a las 4:24, Stephen Cameron <st...@gmail.com>
> escribió:
>
> Hi,
>
> I am using the security module which defines a schema 'isissecurity', but
> in MySQL the security tables get created in the default schema. Everything
> works fine, but I still get an error message at startup which I'd like to
> get rid of.
>
> I'm pretty sure I've seen reference to a means to remap the schema name via
> a Datanucleus configuration (persistence.xml?), if someone could show me
> how this is done, or point me to relevant documentation that would be
> appreciated.
>
> Thanks
> Steve Cameron
>
>
>
> Óscar Bou Bou
> Socio - IT & GRC Management Services Director
> m: +34 620 267 520
> s:  <http://www.govertis.com>www.govertis.com e: o.bou@govertis.com
>
> LinkedIn: https://www.linkedin.com/in/oscarbou
> Twitter:  @oscarbou <https://twitter.com/oscarbou>
>
>
>
> Este mensaje y los ficheros anexos son confidenciales. Los mismos
> contienen información reservada que no puede ser difundida. Si usted ha
> recibido este correo por error, tenga la amabilidad de eliminarlo de su
> sistema y avisar al remitente mediante reenvío a su dirección electrónica;
> no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.
>
> Su dirección de correo electrónico junto a sus datos personales constan en
> un fichero titularidad de GOVERTIS ADVISORY SERVICES, S.L. cuya finalidad
> es la de mantener el contacto con Ud. Si quiere saber de qué información
> disponemos de Ud., modificarla, y en su caso, cancelarla, puede hacerlo
> enviando un escrito al efecto, acompañado de una fotocopia de su D.N.I. a
> la siguiente dirección: GOVERTIS ADVISORY SERVICES, S.L. Avda Cortes
> Valencianas, 58 – 8º - 6ª. 46015 - Valencia,  y Paseo de la Castellana,
> 153, 28045 - MADRID. Asimismo, es su responsabilidad comprobar que este
> mensaje o sus archivos adjuntos no contengan virus informáticos, y en caso
> que los tuvieran eliminarlos.
>
>

Re: Redefining schema name in config file (to override JDO class annotation setting)

Posted by Óscar Bou - GOVERTIS <o....@govertis.com>.
Hi Stephen,

Found Dan’s comment on a issue on github which details how to override it with “package.jdo” in META-INF:

https://github.com/isisaddons/isis-module-security/issues/35


HTH,

Oscar


> El 17 ago 2016, a las 4:24, Stephen Cameron <st...@gmail.com> escribió:
> 
> Hi,
> 
> I am using the security module which defines a schema 'isissecurity', but
> in MySQL the security tables get created in the default schema. Everything
> works fine, but I still get an error message at startup which I'd like to
> get rid of.
> 
> I'm pretty sure I've seen reference to a means to remap the schema name via
> a Datanucleus configuration (persistence.xml?), if someone could show me
> how this is done, or point me to relevant documentation that would be
> appreciated.
> 
> Thanks
> Steve Cameron



Óscar Bou Bou
Socio - IT & GRC Management Services Director
m: +34 620 267 520
s:  <http://www.govertis.com/>www.govertis.com <http://www.govertis.com/> e: o.bou@govertis.com <ma...@govertis.com>

LinkedIn: https://www.linkedin.com/in/oscarbou <https://www.linkedin.com/in/oscarbou>
Twitter: 	@oscarbou <https://twitter.com/oscarbou>



Este mensaje y los ficheros anexos son confidenciales. Los mismos contienen información reservada que no puede ser difundida. Si usted ha recibido este correo por error, tenga la amabilidad de eliminarlo de su sistema y avisar al remitente mediante reenvío a su dirección electrónica; no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.

Su dirección de correo electrónico junto a sus datos personales constan en un fichero titularidad de GOVERTIS ADVISORY SERVICES, S.L. cuya finalidad es la de mantener el contacto con Ud. Si quiere saber de qué información disponemos de Ud., modificarla, y en su caso, cancelarla, puede hacerlo enviando un escrito al efecto, acompañado de una fotocopia de su D.N.I. a la siguiente dirección: GOVERTIS ADVISORY SERVICES, S.L. Avda Cortes Valencianas, 58 – 8º - 6ª. 46015 - Valencia,  y Paseo de la Castellana, 153, 28045 - MADRID. Asimismo, es su responsabilidad comprobar que este mensaje o sus archivos adjuntos no contengan virus informáticos, y en caso que los tuvieran eliminarlos.