You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by Deepak Gopalakrishnan <dg...@gmail.com> on 2014/01/28 04:52:19 UTC

Maxlength for Text type

Hello Dev,

I've been trying an entity which has a property as below...

private String response;


    @javax.jdo.annotations.Column(allowsNull = "true", jdbcType = "text")

    @MemberOrder(name = "Response", sequence = "11")

    @MultiLine(numberOfLines = 10)

    @TypicalLength(800)

    public String getResponse() {

        return response;

    }


My expected behaviour is a text area with any number of characters ( or a
very high upper limit). I however get an error stating that the value
character count exceeds 255 characters ( which is varchar count i believe)


Please tell me what I'm missing here.



-- 
Regards,
*Deepak Gopalakrishnan*
*Mobile*:+918891509774
*Skype* : deepakgk87
http://myexps.blogspot.com

Re: Maxlength for Text type

Posted by Deepak Gopalakrishnan <dg...@gmail.com>.
Thanks Matias, that fixed it


On Tue, Jan 28, 2014 at 8:20 PM, matias nahuel heredia <
matias@informaticos.com> wrote:

> try to change the length in the database.
> El 28/01/14 00:52, Deepak Gopalakrishnan escribió:
>
>  Hello Dev,
>>
>> I've been trying an entity which has a property as below...
>>
>> private String response;
>>
>>
>>      @javax.jdo.annotations.Column(allowsNull = "true", jdbcType =
>> "text")
>>
>>      @MemberOrder(name = "Response", sequence = "11")
>>
>>      @MultiLine(numberOfLines = 10)
>>
>>      @TypicalLength(800)
>>
>>      public String getResponse() {
>>
>>          return response;
>>
>>      }
>>
>>
>> My expected behaviour is a text area with any number of characters ( or a
>> very high upper limit). I however get an error stating that the value
>> character count exceeds 255 characters ( which is varchar count i believe)
>>
>>
>> Please tell me what I'm missing here.
>>
>>
>>
>>
>


-- 
Regards,
*Deepak Gopalakrishnan*
*Mobile*:+918891509774
*Skype* : deepakgk87
http://myexps.blogspot.com

Re: Maxlength for Text type

Posted by matias nahuel heredia <ma...@informaticos.com>.
try to change the length in the database.
El 28/01/14 00:52, Deepak Gopalakrishnan escribió:
> Hello Dev,
>
> I've been trying an entity which has a property as below...
>
> private String response;
>
>
>      @javax.jdo.annotations.Column(allowsNull = "true", jdbcType = "text")
>
>      @MemberOrder(name = "Response", sequence = "11")
>
>      @MultiLine(numberOfLines = 10)
>
>      @TypicalLength(800)
>
>      public String getResponse() {
>
>          return response;
>
>      }
>
>
> My expected behaviour is a text area with any number of characters ( or a
> very high upper limit). I however get an error stating that the value
> character count exceeds 255 characters ( which is varchar count i believe)
>
>
> Please tell me what I'm missing here.
>
>
>


Re: Maxlength for Text type

Posted by Deepak Gopalakrishnan <dg...@gmail.com>.
Thanks Oscar and Dan. I'm using mysql and I want a textarea with unlimited
length. What annotation can I use?


On Tue, Jan 28, 2014 at 1:40 PM, GESCONSULTOR - Óscar Bou <
o.bou@gesconsultor.com> wrote:

> Hi, Deepak.
>
> By default, DataNucleus implementation has a default length for String
> fields of 255 [1], despite it can be changed by config.
>
> If you want longer lengths, you must explicitly add it to the @Column
> annotation.
>
> Simply replace your code by:
>
> private String response;
>
>
>    @javax.jdo.annotations.Column(allowsNull = "true", jdbcType = "text",
> length = 1000)
>
>    @MemberOrder(name = "Response", sequence = "11")
>    @MultiLine(numberOfLines = 10)
>    @TypicalLength(800)
>    public String getResponse() {
>
>        return response;
>
>    }
>
>
> Perhaps the @TypicalLength could be deduced from the @Column(length...),
> but "Typical" is not the same as "Max" length (as the @Column annotation
> indicates)...
>
>
> In Estatio, Dan and Jeroen have centralized all data types lengths to an
> external class, and I find it particularly useful. See [2].
>
> HTH,
>
> Oscar
>
>
> [1] http://www.datanucleus.org/servlet/jira/browse/NUCAPIJDO-37
>
> [2]
> https://github.com/estatio/estatio/blob/master/dom/src/main/java/org/estatio/dom/JdoColumnLength.java
>
>
>
>
>
> El 28/01/2014, a las 07:45, Dan Haywood <da...@haywood-associates.co.uk>
> escribió:
>
>
> It might be the database you're using that has that limit, and/or the
> @Column annotation you have.
>
> I'm just working on an entity right now that has a "memento" property, of
> length 1024.  its annotation is:
>
>    @javax.jdo.annotations.Column(allowsNull="false", length=1024)
>    @MultiLine(numberOfLines=20)
>    @Hidden(where=Where.ALL_TABLES)
>    @MemberOrder(name="Target",sequence = "4")
>    @Disabled
>    public String getMemento() { ... }
>
> This is fine on HSQLDB.
>
> HTH
> Dan
>
>
>
>
>
> On 28 January 2014 03:52, Deepak Gopalakrishnan <dg...@gmail.com> wrote:
>
> Hello Dev,
>
> I've been trying an entity which has a property as below...
>
> private String response;
>
>
>    @javax.jdo.annotations.Column(allowsNull = "true", jdbcType = "text")
>
>    @MemberOrder(name = "Response", sequence = "11")
>
>    @MultiLine(numberOfLines = 10)
>
>    @TypicalLength(800)
>
>    public String getResponse() {
>
>        return response;
>
>    }
>
>
> My expected behaviour is a text area with any number of characters ( or a
> very high upper limit). I however get an error stating that the value
> character count exceeds 255 characters ( which is varchar count i believe)
>
>
> Please tell me what I'm missing here.
>
>
>
> --
> Regards,
> *Deepak Gopalakrishnan*
> *Mobile*:+918891509774
> *Skype* : deepakgk87
> http://myexps.blogspot.com
>
>
>
> Ó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 <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.
>
>
>
>
>
>


-- 
Regards,
*Deepak Gopalakrishnan*
*Mobile*:+918891509774
*Skype* : deepakgk87
http://myexps.blogspot.com

Re: Maxlength for Text type

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

By default, DataNucleus implementation has a default length for String fields of 255 [1], despite it can be changed by config.

If you want longer lengths, you must explicitly add it to the @Column annotation.

Simply replace your code by:

private String response;


   @javax.jdo.annotations.Column(allowsNull = "true", jdbcType = "text", length = 1000)
   @MemberOrder(name = "Response", sequence = "11")
   @MultiLine(numberOfLines = 10)
   @TypicalLength(800)
   public String getResponse() {

       return response;

   }


Perhaps the @TypicalLength could be deduced from the @Column(length...), but "Typical" is not the same as "Max" length (as the @Column annotation indicates)...


In Estatio, Dan and Jeroen have centralized all data types lengths to an external class, and I find it particularly useful. See [2].

HTH,

Oscar


[1] http://www.datanucleus.org/servlet/jira/browse/NUCAPIJDO-37

[2] https://github.com/estatio/estatio/blob/master/dom/src/main/java/org/estatio/dom/JdoColumnLength.java





El 28/01/2014, a las 07:45, Dan Haywood <da...@haywood-associates.co.uk> escribió:

> It might be the database you're using that has that limit, and/or the
> @Column annotation you have.
> 
> I'm just working on an entity right now that has a "memento" property, of
> length 1024.  its annotation is:
> 
>    @javax.jdo.annotations.Column(allowsNull="false", length=1024)
>    @MultiLine(numberOfLines=20)
>    @Hidden(where=Where.ALL_TABLES)
>    @MemberOrder(name="Target",sequence = "4")
>    @Disabled
>    public String getMemento() { ... }
> 
> This is fine on HSQLDB.
> 
> HTH
> Dan
> 
> 
> 
> 
> 
> On 28 January 2014 03:52, Deepak Gopalakrishnan <dg...@gmail.com> wrote:
> 
>> Hello Dev,
>> 
>> I've been trying an entity which has a property as below...
>> 
>> private String response;
>> 
>> 
>>    @javax.jdo.annotations.Column(allowsNull = "true", jdbcType = "text")
>> 
>>    @MemberOrder(name = "Response", sequence = "11")
>> 
>>    @MultiLine(numberOfLines = 10)
>> 
>>    @TypicalLength(800)
>> 
>>    public String getResponse() {
>> 
>>        return response;
>> 
>>    }
>> 
>> 
>> My expected behaviour is a text area with any number of characters ( or a
>> very high upper limit). I however get an error stating that the value
>> character count exceeds 255 characters ( which is varchar count i believe)
>> 
>> 
>> Please tell me what I'm missing here.
>> 
>> 
>> 
>> --
>> Regards,
>> *Deepak Gopalakrishnan*
>> *Mobile*:+918891509774
>> *Skype* : deepakgk87
>> http://myexps.blogspot.com
>> 


Ó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: Maxlength for Text type

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
It might be the database you're using that has that limit, and/or the
@Column annotation you have.

I'm just working on an entity right now that has a "memento" property, of
length 1024.  its annotation is:

    @javax.jdo.annotations.Column(allowsNull="false", length=1024)
    @MultiLine(numberOfLines=20)
    @Hidden(where=Where.ALL_TABLES)
    @MemberOrder(name="Target",sequence = "4")
    @Disabled
    public String getMemento() { ... }

This is fine on HSQLDB.

HTH
Dan





On 28 January 2014 03:52, Deepak Gopalakrishnan <dg...@gmail.com> wrote:

> Hello Dev,
>
> I've been trying an entity which has a property as below...
>
> private String response;
>
>
>     @javax.jdo.annotations.Column(allowsNull = "true", jdbcType = "text")
>
>     @MemberOrder(name = "Response", sequence = "11")
>
>     @MultiLine(numberOfLines = 10)
>
>     @TypicalLength(800)
>
>     public String getResponse() {
>
>         return response;
>
>     }
>
>
> My expected behaviour is a text area with any number of characters ( or a
> very high upper limit). I however get an error stating that the value
> character count exceeds 255 characters ( which is varchar count i believe)
>
>
> Please tell me what I'm missing here.
>
>
>
> --
> Regards,
> *Deepak Gopalakrishnan*
> *Mobile*:+918891509774
> *Skype* : deepakgk87
> http://myexps.blogspot.com
>