I implemented AO in my plugin and the IT tests (using TestActiveObjects and JUnitActiveObjectRunner) all pass to create, persist, update and find my objects.
But when I fire up my SDK instance of confluence the first query bombs out with
java.lang.reflect.UndeclaredThrowableException
at $Proxy1297.prepareStatement(Unknown Source)
caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
caused by: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: ATTACHMENTID
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
caused by: org.hsqldb.HsqlException: user lacks privilege or object not found: ATTACHMENTID
at org.hsqldb.error.Error.error(Unknown Source)
since the field and query in question is "attachmentId" I am not sure why there is no underscore. Alternately I am not sure if that is just because I added that field later, but my upgrade task seems to be ignored. I tried an atlas-clean to blow away any previous HSQL db files, but the error continues.
ao.find(MyObject.class, "attachmentId = ? ", attachment.getId());
@Preload @Table("MYOBJECT") public interface MyObject extends Entity{ public long getAttachmentId(); public void setAttachmentId(long id);
I guess my concerns is the inconsitency, as these queries work just fine using AO's ActiveObjectTest against hsqldb as instructed here? https://developer.atlassian.com/display/AO/Getting+Started+with+Active+Objects#GettingStartedwithActiveObjects-Step12.TesttheTodoservice
And my understanding based on the examples from the author of AO doesn't use the underscore, as pointed in the document you linked to that should be handled by the FieldNameConverter
http://activeobjects.java.net/0.8.2/example.html
You can also see this a bit in the internals of the Query which converts the string to SQL using the field converter.
http://activeobjects.java.net/0.8.2/api/net/java/ao/Query.html#toSQL(java.lang.Class, net.java.ao.DatabaseProvider, net.java.ao.schema.TableNameConverter, net.java.ao.schema.FieldNameConverter, boolean)
Not sure I follow Andy.. I understand the convention, and would expext the column to have underscores. The problem is that when running the query, the query generated is not using the underscores.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It wont, _you_ have interpret the fields and map accordingly, i.e. "attachmentId = ? " ==> "ATTACHMENT_ID = ? "
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yep, inserting underscores on camelCase boundaries is needed, https://developer.atlassian.com/display/AO/Column+names
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm, as I suspected the column generated by AO is using the underscore
CREATE TABLE AO_DF89C4_MYOBJECT (\u000a ATTACHMENT_ID BIGINT DEFAULT 0,.........
so I need to figure out wjhy the query does not translate the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.
Get Certified! ✍️Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.