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 -
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
It looks that you are using @Table("AO_81F455_PERSONAL_TOKEN") in your code, but it seems that it is ignoring this annotation and using the default naming convention, which leads to the longer table name issue that is a combination of both AO_F97F98 and AO_81F455_PERSONAL_TOKEN -> AO_F97F98_AO_81_F455_PERSONAL_TOKEN
That is for sure more characters than 30.. actually 35 if I count correctly
So use a shorter name or remove the prefix completely in the "@Table" then rebuild your plugin and see how it works :)
Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!
Help us plant more trees
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.