I'm developing a JIRA plugin in which I use ActiveObjects (using version 0.19.7). I have entities which I want to find using ActiveObjects queries. E.g. like this:
this.ao.find(MyEntity.class, Query.select().where("SOME_ATTRIBUTE=?", someAttributeValue);
I know that PostgreSQL handles column names case sensitively, I double checked that the database table has the physical column names in uppercase. Therefore I always use uppercase queries as in the example above.
Regardless of this, I always get the below exception:
Caused by: org.postgresql.util.PSQLException: ERROR: column "some_attribute" does not exist
Any idea how to overcome this with PostgreSQL?
If you phrase you query with spaces before and after the equation mark (=), then AO uses the correct column name in queries. So the correct query is (nopte the spaces before and after the = character):
this.ao.find(MyEntity.class, Query.select().where("SOME_ATTRIBUTE = ?", someAttributeValue);
Sad that I lost a few hours on this...
So I lost full day, but found solution.
My case is Postgresql 8, Jira 5.0.4. AO 0.18.2
In the following string column names should be in uppercase and also dont forget trailing spaces at the both sides of "=". If you want to use ORDER BY or other sql syntax you should escape them with quotes according to DB.
" PROJECT = ? AND MASTERISSTYPE = ? ORDER BY \"ID\"", projectId, masterIssueTypeId);
Also i found that 0.18.5 and 0.19.7 versions dont give a good result. At my own opinion developers have broken something you can see those links:
also you can try version 0.22 and write here about results
Hi Tibor, adding spaces for equation works fine. However I am facing the same problem while ordering. For instance, here is my query ending with order statement and getting the same error for "SORT_ORDER" column .order("myTable.SORT_ORDER")); Any idea, how I can achieve this problem? Thanks Tuncay
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs