Hello Everyone,
I want to perform query on table named as "AO_81F455_PERSONAL_TOKEN",but it is always taking table named as "AO_F97F98_PERSONAL_TOKEN",when I am adding @table annotation then getting below error ,kindly help, how we can delete token of specific user through jira plugin.Please find the code snippet and error below-
error -
com.google.common.util.concurrent.UncheckedExecutionException: com.google.common.util.concurrent.UncheckedExecutionException: net.java.ao.ActiveObjectsException: Invalid entity, generated table name (AO_F97F98_AO_81_F455_PERSONAL_TOKEN) for 'ao.PersonalToken' is too long! It should be no longer than 30 chars.
package ao;
import net.java.ao.Entity;
import net.java.ao.Preload;
import net.java.ao.schema.Table;
@Table("AO_81F455_PERSONAL_TOKEN")
@Preload("*")
public interface PersonalToken extends Entity {
String getUserKey();
void setUserKey(String userKey);
}
public void deleteTokensForUser(ApplicationUser user) {
String userKey = user.getKey();
logger.debug("userKey:" + userKey);
if(userKey!=null){
ao.executeInTransaction(() -> {
PersonalToken[] tokens = ao.find(PersonalToken.class, Query.select().where("USER_KEY = ?", userKey));
logger.debug("tokens:"+tokens);
for (PersonalToken token : tokens) {
logger.debug("token:"+token);
ao.delete(token);
logger.info("Deleted token with ID :"+token.getID()+" for userKey :"+userKey);
}
return null;
});
}
}
Kindly help how we can achieve these in jira plugin.
Thanks and Regards,
Jyoti