Active Objects not creating table

Alok Singh April 30, 2015

I have followed the documentation and added all the required code in my plugin still I cannot see the table when I check the plugin data storage.

 

atlassian-plugin.xml

<component key="ProdConfServic" name="Prod Setting Service" class="com.leanpitch.leangears.ao.ProdConfServiceImpl" public="true">
<interface>com.leanpitch.leangears.ao.ProdConfService</interface>
</component>

<ao key="ao-module">
<entity>com.leanpitch.leangears.ao.ProdConf</entity>
</ao>

<component-import key="ao" name="Active Objects service" interface="com.atlassian.activeobjects.external.ActiveObjects">
<description>Component to access Active Objects functionality from the plugin</description>
</component-import>
<component key="tx-processor" name="Transactional Annotation Processor" class="com.atlassian.activeobjects.external.TransactionalAnnotationProcessor">
<decription>Processes @Transactional annotations.</decription>
</component>
ProdConf.java

 

import net.java.ao.Accessor;
import net.java.ao.Entity;
import net.java.ao.Mutator;
import net.java.ao.Preload;
import net.java.ao.schema.StringLength;
import net.java.ao.schema.Table;

@Preload
@Table("ProdConf")

public interface ProdConf extends Entity{


    @Accessor("ProductName")
    String getProductName();
    @Mutator("ProductName")
    void setProductName(String productName);


    @Accessor("EndUsers")
    String getEndUsers();
    @Mutator("EndUsers")
    void setEndUers(String endUers);
}
ProdConfService.java
@Transactional
public interface ProdConfService {

    void add(String productName, String endUsers);
}
ProdConfServiceImpl.java

 

import com.atlassian.activeobjects.external.ActiveObjects;
import net.java.ao.Query;

import java.util.List;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Lists.newArrayList;

/**
 * Created by root on 30/4/15.
 */
public class ProdConfServiceImpl  implements ProdConfService{

    private final ActiveObjects ao;

    public ProdConfServiceImpl(ActiveObjects ao){
        this.ao = checkNotNull(ao);
    }

    @Override
    public void add(String productName, String endUsers){

        

        final ProdConf prodConf = ao.create(ProdConf.class);

        prodConf.setProductName(productName);

        prodConf.setEndUers(endUsers);
        prodConf.save();

    }

}

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Volodymyr Krupach
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.
April 30, 2015

Do not worry, it's there. The table name is prefixed with some hash number like "AO_123456" so you table name should be name "AO_123456_PRODCONF"

Alok Singh April 30, 2015

Thanks Volodymyr, but I could not find any such table in Plugin data storage

Volodymyr Krupach
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.
April 30, 2015

Any exceptions in the log? What version of the activeobjects-plugin do you have in the pom?

Alok Singh April 30, 2015

I checked the log and it does not show anything. <dependency> <groupId>com.atlassian.activeobjects</groupId> <artifactId>activeobjects-plugin</artifactId> <version>0.23.12</version> <scope>provided</scope> </dependency> <!-- SAL, the Active Objects plugin uses SAL's API for transactions --> <dependency> <groupId>com.atlassian.sal</groupId> <artifactId>sal-api</artifactId> <version>2.6.0</version> <scope>provided</scope> </dependency>

Volodymyr Krupach
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.
April 30, 2015

What happens when you execute/debug the code that actually use AOs?

Volodymyr Krupach
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.
April 30, 2015

I have the same version of the sal-api and mine activeobjects-plugin is 0.29.3. The rest code is similar to yours.

Alok Singh May 1, 2015

Thanks Volodymyr. It's working fine now as there was a problem with the call I was making to the service Impl code. Thanks for your assistance!

TAGS
AUG Leaders

Atlassian Community Events