View Full Version : blob or byte arrays in roo jpa
solid
Oct 25th, 2009, 07:10 PM
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.
Ben Alex
Oct 26th, 2009, 02:24 AM
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.
kengkaj.s
Dec 1st, 2009, 04:36 AM
I've created an issue about this.
https://jira.springsource.org/browse/ROO-441
Hopefully, it's not duplicate.
gpitteloud
Dec 1st, 2009, 08:56 AM
If you manually add a field of the form
@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.
Ben Alex
Dec 1st, 2009, 11:42 PM
@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.
gpitteloud
Dec 2nd, 2009, 01:29 AM
Thanks for the reply, this is all fine now.
adam37
Apr 21st, 2012, 05:54 AM
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
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.