You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by Dileepa Jayakody <di...@gmail.com> on 2014/07/23 12:58:50 UTC

Can I increase max.length of String columns in Isis JDO ?

Hi All,

In my project developed using Isis, I'm persisting an email entity in which
emailHeader is stored as a String.
When trying to persist the entities I get following error indicating the
value of emailHeaders exceed the default max.length of JDO/datanucleus. Can
I increase this max.length? Do I need to use another type to store the
emailHeaders?

Thanks,
Dileepa

 " in column ""emailHeaders"" that has maximum length of 255. Please
correct
your data!
     [exec]     at
org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:498)
     [exec]     at
org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:736)
     [exec]     at
org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:756)

Re: Can I increase max.length of String columns in Isis JDO ?

Posted by GESCONSULTOR - Óscar Bou <o....@gesconsultor.com>.
Hi, Dileepa,

Have you tried @Column(length=1000) ?

Please, see [1].


HTH,

Oscar

[1] http://www.datanucleus.org/products/datanucleus/jdo/annotations.html#Column




El 23/07/2014, a las 12:58, Dileepa Jayakody <di...@gmail.com> escribió:

> Hi All,
> 
> In my project developed using Isis, I'm persisting an email entity in which
> emailHeader is stored as a String.
> When trying to persist the entities I get following error indicating the
> value of emailHeaders exceed the default max.length of JDO/datanucleus. Can
> I increase this max.length? Do I need to use another type to store the
> emailHeaders?
> 
> Thanks,
> Dileepa
> 
> " in column ""emailHeaders"" that has maximum length of 255. Please
> correct
> your data!
>     [exec]     at
> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:498)
>     [exec]     at
> org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:736)
>     [exec]     at
> org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:756)


Óscar Bou Bou
Responsable de Producto
Auditor Jefe de Certificación ISO 27001 en BSI
CISA, CRISC, APMG ISO 20000, ITIL-F

   902 900 231 / 620 267 520
   http://www.twitter.com/oscarbou

   http://es.linkedin.com/in/oscarbou

   http://www.GesConsultor.com 




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 Gesdatos Software, 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: Gesdatos Software, S.L. , Paseo de la Castellana, 153 bajo - 28046 (Madrid), y Avda. Cortes Valencianas num. 50, 1ºC - 46015 (Valencia). 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: Can I increase max.length of String columns in Isis JDO ?

Posted by Dileepa Jayakody <di...@gmail.com>.
Thanks a lot for the details Dan.


On Fri, Jul 25, 2014 at 6:51 PM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:

> Although I've not tried it, you *should* be able to persist anything that
> JDO supports, and that includes Maps.  [1]
>
> However, the Isis metamodel does not recognize Maps, so you will need to
> annotate its getter and setter as @Programmatic else bad things will happen
> (Isis almost certainly won't boot, and will throw a meta-model violation
> error)..
>
> If you stick to using Collections rather than Maps (SortedSets are what we
> recommend) then Isis will be able to render the collection.
>
> Also, you'll find that JDO will replace the HashSet (or HashMap, or
> whatever) with its own Set implementation.    There's shouldn't be any need
> to use a ConcurrentHashMap, each JDO-managed entity is "owned" by a single
> request/thread.
>
> One other point: an alternative option is to serialize these data
> structures to strings or similar and store in a blob.
>
> HTH
> Dan
>
>
> [1]
>
> http://www.datanucleus.org/products/datanucleus/jdo/orm/one_to_many_map.html
>
>
>
> On 25 July 2014 14:14, Dileepa Jayakody <di...@gmail.com> wrote:
>
> > Hi All,
> >
> > Can I persist implementations of Map interface (HashMap,
> ConcurrentHashMap)
> > and Set interface (HashSet) in Isis?
> >
> > In one of my entity classes I had to include these data types for data
> > anlysis purposes.
> > When I go through the persistence debug logs when the database is created
> > at server startup, I notice that above properties in my entity class are
> > not mapped to any db_schema by jdo.
> >
> > Thanks,
> > Dileepa
> >
> >
> > On Wed, Jul 23, 2014 at 4:44 PM, Dileepa Jayakody <
> > dileepajayakody@gmail.com
> > > wrote:
> >
> > > Thanks Oscar and Dan.
> > >
> > > I tried using @Column(length=1000), the max.length error is gone, but
> now
> > > I'm getting an aborted Isis transaction [1] for some reason. Maybe it's
> > due
> > > to some other reason, I will check that.
> > >
> > > Thanks for the pointers.
> > >
> > > Regards,
> > > Dileepa
> > >
> > > [1]
> > > [exec] 16:39:01,440  [IsisTransaction      qtp1065406375-36 INFO ]
>  abort
> > > transaction IsisTransaction@31117256[state=MUST_ABORT,commands=0]
> > >
> > >
> > >
> > >
> > > On Wed, Jul 23, 2014 at 4:34 PM, Dan Haywood <
> > dan@haywood-associates.co.uk
> > > > wrote:
> > >
> > >> On 23 July 2014 11:58, Dileepa Jayakody <di...@gmail.com>
> > >> wrote:
> > >>
> > >> > Hi All,
> > >> >
> > >> > In my project developed using Isis, I'm persisting an email entity
> in
> > >> which
> > >> > emailHeader is stored as a String.
> > >> > When trying to persist the entities I get following error indicating
> > the
> > >> > value of emailHeaders exceed the default max.length of
> > JDO/datanucleus.
> > >> Can
> > >> > I increase this max.length? Do I need to use another type to store
> the
> > >> > emailHeaders?
> > >> >
> > >> >
> > >> Or, you could use CLOB, I think, see [1]
> > >>
> > >> But SQL Server supports lengths up to 8000 (or is it 4000), so you
> might
> > >> want to explore just specifying a longer length as well; it might work
> > >> depending on the RDBMS you are using (as per Oscar's suggestion)
> > >>
> > >> Downside of using CLOB... the data is stored off-record, so is more
> > >> expensive to read (for the DBMS).
> > >>
> > >> HTH
> > >> Dan
> > >>
> > >> [1]
> > >>
> > >>
> >
> https://github.com/apache/isis/blob/master/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdo.java#L434
> > >>
> > >>
> > >>
> > >>
> > >> > Thanks,
> > >> > Dileepa
> > >> >
> > >> >  " in column ""emailHeaders"" that has maximum length of 255. Please
> > >> > correct
> > >> > your data!
> > >> >      [exec]     at
> > >> >
> > >> >
> > >>
> >
> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:498)
> > >> >      [exec]     at
> > >> >
> > >> >
> > >>
> >
> org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:736)
> > >> >      [exec]     at
> > >> >
> > >> >
> > >>
> >
> org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:756)
> > >> >
> > >>
> > >
> > >
> >
>

Re: Can I increase max.length of String columns in Isis JDO ?

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Although I've not tried it, you *should* be able to persist anything that
JDO supports, and that includes Maps.  [1]

However, the Isis metamodel does not recognize Maps, so you will need to
annotate its getter and setter as @Programmatic else bad things will happen
(Isis almost certainly won't boot, and will throw a meta-model violation
error)..

If you stick to using Collections rather than Maps (SortedSets are what we
recommend) then Isis will be able to render the collection.

Also, you'll find that JDO will replace the HashSet (or HashMap, or
whatever) with its own Set implementation.    There's shouldn't be any need
to use a ConcurrentHashMap, each JDO-managed entity is "owned" by a single
request/thread.

One other point: an alternative option is to serialize these data
structures to strings or similar and store in a blob.

HTH
Dan


[1]
http://www.datanucleus.org/products/datanucleus/jdo/orm/one_to_many_map.html



On 25 July 2014 14:14, Dileepa Jayakody <di...@gmail.com> wrote:

> Hi All,
>
> Can I persist implementations of Map interface (HashMap, ConcurrentHashMap)
> and Set interface (HashSet) in Isis?
>
> In one of my entity classes I had to include these data types for data
> anlysis purposes.
> When I go through the persistence debug logs when the database is created
> at server startup, I notice that above properties in my entity class are
> not mapped to any db_schema by jdo.
>
> Thanks,
> Dileepa
>
>
> On Wed, Jul 23, 2014 at 4:44 PM, Dileepa Jayakody <
> dileepajayakody@gmail.com
> > wrote:
>
> > Thanks Oscar and Dan.
> >
> > I tried using @Column(length=1000), the max.length error is gone, but now
> > I'm getting an aborted Isis transaction [1] for some reason. Maybe it's
> due
> > to some other reason, I will check that.
> >
> > Thanks for the pointers.
> >
> > Regards,
> > Dileepa
> >
> > [1]
> > [exec] 16:39:01,440  [IsisTransaction      qtp1065406375-36 INFO ]  abort
> > transaction IsisTransaction@31117256[state=MUST_ABORT,commands=0]
> >
> >
> >
> >
> > On Wed, Jul 23, 2014 at 4:34 PM, Dan Haywood <
> dan@haywood-associates.co.uk
> > > wrote:
> >
> >> On 23 July 2014 11:58, Dileepa Jayakody <di...@gmail.com>
> >> wrote:
> >>
> >> > Hi All,
> >> >
> >> > In my project developed using Isis, I'm persisting an email entity in
> >> which
> >> > emailHeader is stored as a String.
> >> > When trying to persist the entities I get following error indicating
> the
> >> > value of emailHeaders exceed the default max.length of
> JDO/datanucleus.
> >> Can
> >> > I increase this max.length? Do I need to use another type to store the
> >> > emailHeaders?
> >> >
> >> >
> >> Or, you could use CLOB, I think, see [1]
> >>
> >> But SQL Server supports lengths up to 8000 (or is it 4000), so you might
> >> want to explore just specifying a longer length as well; it might work
> >> depending on the RDBMS you are using (as per Oscar's suggestion)
> >>
> >> Downside of using CLOB... the data is stored off-record, so is more
> >> expensive to read (for the DBMS).
> >>
> >> HTH
> >> Dan
> >>
> >> [1]
> >>
> >>
> https://github.com/apache/isis/blob/master/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdo.java#L434
> >>
> >>
> >>
> >>
> >> > Thanks,
> >> > Dileepa
> >> >
> >> >  " in column ""emailHeaders"" that has maximum length of 255. Please
> >> > correct
> >> > your data!
> >> >      [exec]     at
> >> >
> >> >
> >>
> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:498)
> >> >      [exec]     at
> >> >
> >> >
> >>
> org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:736)
> >> >      [exec]     at
> >> >
> >> >
> >>
> org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:756)
> >> >
> >>
> >
> >
>

Re: Can I increase max.length of String columns in Isis JDO ?

Posted by Dileepa Jayakody <di...@gmail.com>.
Hi All,

Can I persist implementations of Map interface (HashMap, ConcurrentHashMap)
and Set interface (HashSet) in Isis?

In one of my entity classes I had to include these data types for data
anlysis purposes.
When I go through the persistence debug logs when the database is created
at server startup, I notice that above properties in my entity class are
not mapped to any db_schema by jdo.

Thanks,
Dileepa


On Wed, Jul 23, 2014 at 4:44 PM, Dileepa Jayakody <dileepajayakody@gmail.com
> wrote:

> Thanks Oscar and Dan.
>
> I tried using @Column(length=1000), the max.length error is gone, but now
> I'm getting an aborted Isis transaction [1] for some reason. Maybe it's due
> to some other reason, I will check that.
>
> Thanks for the pointers.
>
> Regards,
> Dileepa
>
> [1]
> [exec] 16:39:01,440  [IsisTransaction      qtp1065406375-36 INFO ]  abort
> transaction IsisTransaction@31117256[state=MUST_ABORT,commands=0]
>
>
>
>
> On Wed, Jul 23, 2014 at 4:34 PM, Dan Haywood <dan@haywood-associates.co.uk
> > wrote:
>
>> On 23 July 2014 11:58, Dileepa Jayakody <di...@gmail.com>
>> wrote:
>>
>> > Hi All,
>> >
>> > In my project developed using Isis, I'm persisting an email entity in
>> which
>> > emailHeader is stored as a String.
>> > When trying to persist the entities I get following error indicating the
>> > value of emailHeaders exceed the default max.length of JDO/datanucleus.
>> Can
>> > I increase this max.length? Do I need to use another type to store the
>> > emailHeaders?
>> >
>> >
>> Or, you could use CLOB, I think, see [1]
>>
>> But SQL Server supports lengths up to 8000 (or is it 4000), so you might
>> want to explore just specifying a longer length as well; it might work
>> depending on the RDBMS you are using (as per Oscar's suggestion)
>>
>> Downside of using CLOB... the data is stored off-record, so is more
>> expensive to read (for the DBMS).
>>
>> HTH
>> Dan
>>
>> [1]
>>
>> https://github.com/apache/isis/blob/master/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdo.java#L434
>>
>>
>>
>>
>> > Thanks,
>> > Dileepa
>> >
>> >  " in column ""emailHeaders"" that has maximum length of 255. Please
>> > correct
>> > your data!
>> >      [exec]     at
>> >
>> >
>> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:498)
>> >      [exec]     at
>> >
>> >
>> org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:736)
>> >      [exec]     at
>> >
>> >
>> org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:756)
>> >
>>
>
>

Re: Can I increase max.length of String columns in Isis JDO ?

Posted by Dileepa Jayakody <di...@gmail.com>.
Thanks Oscar and Dan.

I tried using @Column(length=1000), the max.length error is gone, but now
I'm getting an aborted Isis transaction [1] for some reason. Maybe it's due
to some other reason, I will check that.

Thanks for the pointers.

Regards,
Dileepa

[1]
[exec] 16:39:01,440  [IsisTransaction      qtp1065406375-36 INFO ]  abort
transaction IsisTransaction@31117256[state=MUST_ABORT,commands=0]




On Wed, Jul 23, 2014 at 4:34 PM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:

> On 23 July 2014 11:58, Dileepa Jayakody <di...@gmail.com> wrote:
>
> > Hi All,
> >
> > In my project developed using Isis, I'm persisting an email entity in
> which
> > emailHeader is stored as a String.
> > When trying to persist the entities I get following error indicating the
> > value of emailHeaders exceed the default max.length of JDO/datanucleus.
> Can
> > I increase this max.length? Do I need to use another type to store the
> > emailHeaders?
> >
> >
> Or, you could use CLOB, I think, see [1]
>
> But SQL Server supports lengths up to 8000 (or is it 4000), so you might
> want to explore just specifying a longer length as well; it might work
> depending on the RDBMS you are using (as per Oscar's suggestion)
>
> Downside of using CLOB... the data is stored off-record, so is more
> expensive to read (for the DBMS).
>
> HTH
> Dan
>
> [1]
>
> https://github.com/apache/isis/blob/master/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdo.java#L434
>
>
>
>
> > Thanks,
> > Dileepa
> >
> >  " in column ""emailHeaders"" that has maximum length of 255. Please
> > correct
> > your data!
> >      [exec]     at
> >
> >
> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:498)
> >      [exec]     at
> >
> >
> org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:736)
> >      [exec]     at
> >
> >
> org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:756)
> >
>

Re: Can I increase max.length of String columns in Isis JDO ?

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 23 July 2014 11:58, Dileepa Jayakody <di...@gmail.com> wrote:

> Hi All,
>
> In my project developed using Isis, I'm persisting an email entity in which
> emailHeader is stored as a String.
> When trying to persist the entities I get following error indicating the
> value of emailHeaders exceed the default max.length of JDO/datanucleus. Can
> I increase this max.length? Do I need to use another type to store the
> emailHeaders?
>
>
Or, you could use CLOB, I think, see [1]

But SQL Server supports lengths up to 8000 (or is it 4000), so you might
want to explore just specifying a longer length as well; it might work
depending on the RDBMS you are using (as per Oscar's suggestion)

Downside of using CLOB... the data is stored off-record, so is more
expensive to read (for the DBMS).

HTH
Dan

[1]
https://github.com/apache/isis/blob/master/core/module-command-jdo/src/main/java/org/apache/isis/objectstore/jdo/applib/service/command/CommandJdo.java#L434




> Thanks,
> Dileepa
>
>  " in column ""emailHeaders"" that has maximum length of 255. Please
> correct
> your data!
>      [exec]     at
>
> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:498)
>      [exec]     at
>
> org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:736)
>      [exec]     at
>
> org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:756)
>