Problem with ManyToMany active objects relationship [a.o 0.24, confluence 5.3.1]
Asked by XXX XXX:

Hi all,

I have a problem with active objects. Here are the different classes defined. Could you tell me what's wrong? I am using oracle database, a.o 0.24 and confluence 5.3.1.

Document:

```
public interface Document extends BaseModel {	@NotNull	public String getTitle();	public void setTitle(String title);	@ManyToMany(reverse = "getDocument", through = "getKeyword", value = DocumentToKeyword.class)	public Keyword[] getKeywords();	public void setKeywords(Keyword[] keywords);	@ManyToMany(reverse = "getDocument", through = "getCategory", value = DocumentToCategory.class)	public Category[] getCategories();	public void setCategories(Category[] categories);	public String getDescription();	public void setDescription(String description);	@NotNull	public InputStream getDocument();	public void setDocument(InputStream document);	public InputStream getDocumentPreview();	public void setDocumentPreview(InputStream documentPreview);	@NotNull	public int getPublicationYear();	public void setPublicationYear(int publicationYear);	@NotNull	public String getAuthor();	public void setAuthor(String author);	public String getType();	public void setType(String type);}
```

Category:

```
public interface Category extends BaseModel {	@NotNull	public String getName();	public void setName(String name);	@ManyToMany(reverse = "getCategory", through = "getDocument", value = DocumentToCategory.class)	public Document[] getDocuments();	public void setDocuments(Document[] documents);}
```

Keyword

```
public interface Keyword extends BaseModel {	@NotNull	public String getName();	public void setName(String name);	@ManyToMany(reverse = "getKeyword", through = "getDocument", value = DocumentToKeyword.class)	public Document[] getDocuments();	public void setDocuments(Document[] documents);}
```

And the two mapping classes:

```
public interface DocumentToCategory extends Entity {	public Document getDocument();	public void setDocument(Document document);	public Category getCategory();	public void setCategory(Category category);}
```

```
public interface DocumentToKeyword extends Entity {	public Document getDocument();	public void setDocument(Document document);	public Keyword getKeyword();	public void setKeyword(Keyword keyword);}
```

If I remove those two fields (Category/Keyword) from my Document entity everything works fine.

Here are my entities defined:

```
&lt;ao key="ao-module"&gt;		&lt;description&gt;The module configuring the Active Objects service used by			this plugin		&lt;/description&gt;		&lt;entity&gt;confluence.plugin.model.Category&lt;/entity&gt;		&lt;entity&gt;confluence.plugin.model.Document&lt;/entity&gt;		&lt;entity&gt;confluence.plugin.model.Rating&lt;/entity&gt;		&lt;entity&gt;confluence.plugin.model.Keyword&lt;/entity&gt;		&lt;entity&gt;confluence.plugin.model.DocumentToKeyword&lt;/entity&gt;		&lt;entity&gt;confluence.plugin.model.DocumentToCategory&lt;/entity&gt;	&lt;/ao&gt;
```


Answers:
author: XXX XXX
body: The problem is the definition of the setters in the classes Document/Keyword. It seems it s not possible to do so. After simply removing them the schema is correctly created in the database.


Tags: active-objects

oracle