Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveObjects - jira

b
Contributor
March 29, 2012

Hi,

I created my entity class as required in ActiveObjects plugin, and everything is OK until I add array field.

@Preload
public interface XEntity extends Entity {

	public String getIssueId();

	public void setIssueId(String issueId);

	public String getUserName();

	public void setUserName(String userName);

	public String getName();

	public void setName(String name);

//	public String[] getJiraUser();
//
//	public void setJiraUser(String[] jiraUser);
//
//	public String[] getProjectRole();
//
//	public void setProjectRole(String[] projectRole);
//
//	public String[] getIssueRole();
//
//	public void setIssueRole(String[] issueRole);

	public String getTopic();

	public void setTopic(String topic);

	public String getContents();

	public void setContents(String contents);
}

If I uncomment code I get `java.lang.RuntimeException: Unrecognized type` exception. Is that possible to store arrays?

2 answers

1 accepted

2 votes
Answer accepted
Samuel Le Berrigaud
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 29, 2012

AO supports arrays but not arrays of primitives. So you can use arrays of entities. Replacing String[] with MyOtherEntity[] for example.

Krzysztof Skoropada March 31, 2012

Hi, I have similar problem

public interface Filter extends Entity {
	@OneToMany
	public Recipt[] getRecipients();
public void setRecipient(Recipt[] recipients);
}

public interface Recipt extends Entity {
	public Filter getFilter();
	public void setFilter(Filter filter);
}

In my action class I have exception in this line:

final Filter filter = ao.create(Filter.class);

Unrecognized type: [Lpl.skoropada.entities.Recipt;

And I don't know why..

Samuel Le Berrigaud
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 3, 2012

Can you give a bit more details? Your AO module configuration? The full stack trace? It looks like your get and set methods are not named the same (one has an 's' the other doesn't).

Maybe worth creating a new question.

b
Contributor
April 3, 2012

Try to remove line

public void setRecipient(Recipt[] recipients);

J05huaNathaniel May 18, 2019

For all who stumble onto this page the answer makes sense because of the relationship between entities. Filter has a @OneToMany relationship with Recipient. This means that the setter is done on the Recipient entity(setting the Filter) and because of the way relational databases work when you call the function getRecipients on Filter it will return an array of recipients. And just like that, Bob's your uncle.

0 votes
Krzysztof Skoropada March 30, 2012

Hi, I have similar problem

public interface Filter extends Entity {
	@OneToMany
	public Recipt[] getRecipients();
public void setRecipient(Recipt[] recipients);
}

public interface Recipt extends Entity {
	public Filter getFilter();
	public void setFilter(Filter filter);
}

In my action class I have exception in this line:

final Filter filter = ao.create(Filter.class);

Unrecognized type: [Lpl.skoropada.entities.Recipt;

And I don't know why..

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events