Results 1 to 7 of 7

Thread: blob or byte arrays in roo jpa

  1. #1
    Join Date
    Jun 2008
    Location
    Jacksonville, Florida
    Posts
    147

    Default blob or byte arrays in roo jpa

    I am using roo to build my entity. I am trying to add a byte[] or blob type to my entity. How do I do that? when specifying the field type I am tempted to specify other but I don't know what to do after that.

    Btw, you spring guys had some amazing presos on roo at spring 2gx. Keep it coming.

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Thanks for the positive feedback about our SpringOne presentations. We certainly enjoyed it and were highly encouraged by the audience reaction.

    Roo's "field" commands do not presently support creation of fields that include an array access modifier. You might like to add an enhancement request to Jira, as it's not difficult for us to support arrays on fields generally and certainly not hard to add a "field byte" command either. You can find Jira at https://jira.springsource.org/browse/ROO. In the meantime you can easily edit the .java file using a text editor or IDE and add the field by hand. Roo will still parse the field and support it.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  3. #3

    Default

    I've created an issue about this.
    https://jira.springsource.org/browse/ROO-441

    Hopefully, it's not duplicate.

  4. #4

    Default

    If you manually add a field of the form
    Code:
    @Lob
    @Basic(fetch=LAZY)
    private byte[] file;
    to your roo-generated entity class, all aspects related to that entity are deleted. When your remove the byte[] field, they are recreated.

    On STS 2.2.1.200910210131-RELEASE, roo 1.0.0.RC3 [rev 401].

    Actually, it looks like roo does not support @Basic; @Lob is OK.
    Last edited by gpitteloud; Dec 1st, 2009 at 09:05 AM.
    --
    Gaëtan PITTELOUD

  5. #5
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    @Basic(fetch=LAZY) is probably the problem. Try fully-qualifying the LAZY, as in @Basic(fetch=javax.persistence.FetchType.LAZY) (or ensure javax.persistence.FetchType is fully imported and then you're using it in the form of @Basic(fetch=FetchType.LAZY)). Background details in https://jira.springsource.org/browse/ROO-306.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  6. #6

    Default

    Thanks for the reply, this is all fine now.
    --
    Gaëtan PITTELOUD

  7. #7
    Join Date
    Dec 2011
    Posts
    6

    Default

    For the next who will have the same doubts, here is an example of how to do it:
    http://www.youtube.com/watch?v=0cZCgrskkaQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •