Active objects: Unlimited string field length

Juan Jose August 22, 2012

Hello,

I hope someone can help:

I am using "net.java.ao.schema.StringLength" annotation as shown next because I need to store arbitrary length scripts. I am using Mysql and the field is being created as varchar(255) so it is very limited.

@StringLength(StringLength.UNLIMITED)
    @Accessor("SCRIPT")
    @NotNull
    String getScript();
    @StringLength(StringLength.UNLIMITED)
    @Accessor("SCRIPT")
    @NotNull
    void setScript(String script);

Please, any advice would be appreciated.

Thanks in advance.

4 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
nsacerdote
Contributor
December 11, 2012

Maybe you have already resolved the problem but...

If i were you, I would remove the mutator and accessor annotations, just to test. Also you should make sure you are using AO 0.18.X (when @StringLength annotation was added). You should have something like this on your pom.xml:

<dependency>
	  <groupId>com.atlassian.activeobjects</groupId>
	  <artifactId>activeobjects-plugin</artifactId>
	  <version>0.18.4</version>
	  <scope>provided</scope>
</dependency>

You can find more information on AO 0.18.X here:

https://developer.atlassian.com/display/AO/AO+0.18.x+Upgrade+Guide

Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2012

Perhaps, but regarding versions, JIRA 5.0 shipped with 0.19.7 and JIRA 5.2 with 0.19.16?

nsacerdote
Contributor
December 12, 2012

ehmm I really don't know, where did you get that info?

I write version 0.18.4 because in AO+0.18.x+Upgrade+Guide they wrote:

"Active Objects 0.18.4 is the first AO version in this series that you should use"

If you write in your pom.xml that you will use, for instance, version 0.9.6 then you will be using that version, at least that's what happened to me, and couldn't use @StringLength annotation because of that.

Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2012

Well, if you're targetting current releases, you need to use the AO library version they ship with. Documentation accuracy fades over time! Ahm, regarding where this info comes from, in your maven pom.xml, look for activeobjects as a transitive dependency, or check your JIRA_HOME/plugins/.bundled-plugins/activeobjects*

nsacerdote
Contributor
December 12, 2012

Now I have a question!

It's related but I think it's a different question!

0 votes
Juan Jose August 22, 2012

Thank you for your responses.

I have modified the code with no luck. The "SCRIPT" field shoud be "TEXT" type at database but "VARCHAR" is created.

package com.mnemo.atlassian.jira.plugin.issueimport.ao;

import net.java.ao.Accessor;
import net.java.ao.Entity;
import net.java.ao.Mutator;
import net.java.ao.schema.NotNull;
import net.java.ao.schema.StringLength;

public interface Process extends Entity {

	@Accessor("NAME")
	@NotNull
	String getName();
	void setName(String name);
	
	@StringLength(value=StringLength.UNLIMITED)
	@Accessor("SCRIPT")
	@NotNull
	String getScript();
	@StringLength(value=StringLength.UNLIMITED)
	@Mutator("SCRIPT")
	@NotNull
	void setScript(String script);

}


0 votes
jhinch (Atlassian)
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2012

Line 6 should be

@Mutator("SCRIPT")
Not sure if that will fix the issue or not
0 votes
Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 22, 2012

Sorry, whats the question?

I just have this kind of thing to attain an unlimited field, worksforme:

@StringLength(value=StringLength.UNLIMITED)

public void setBlacklistedAttachmentTypes(String blacklistedAttachmentTypes);

public String getBlacklistedAttachmentTypes();


Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events