Hi all,
I'm currently developping a plugin using ActiveObjects to store entities.
I have a need to access the entities tables directly using SQL, and for this i need to know the table name. The problematic part is the generated hexadecimal part of the table name.
I wish there was a @Table annotation like in hibernate where one could specify the table name, but with AO, this annotation does not work this way.
So i need to access the TableNameConverter to be able to retrieve the table name for my entity. The problem is i cannot get :
It seems everything has been done to prevent developpers to access database directly. But i really need to.
Please could someone tell me if there is a simple solution to get the table name for my entity ?
(Oh and i don't want to create an entity instance then getEntityManager on the instance, this is ugly).
Thanks in advance for your answers !
Community moderators have prevented the ability to post new answers.
Why do you need to get the entity directly? It kinda defeats the ActiveObjects usage.. Reverse engineering the creation of the tables is a pain - you need to take into consideration the sha of the plugin key as well (and if the AO library changes how it does it - you're going to get hurt).
Hi Daniel,
I know it's against the concepts of ActiveObjects. But an ORM frameword is good while it is asked to do tasks that match is goal (easily store, update, read and delete business objects, without caring about the underlying structure). But this data can be used for other goals that the ORM is not made to handle. For example, you can store people using a service, what part of the service they use, and so on, but if you want to make some statistics, you'll have to execute some SQL queries against the tables holding the business objects with complex combinations. This is best done by accessing directly the tables through SQL.
What i don't understand with AO is the @Table is supposed to allow us to specify the table name (saw it in the AO doc) but when i use it in my confluence plugin, the table name is only appended after the AO_XXXXX_ part.
I think AO goes too far in the "forget the database" paradigm, preventing us from choosing the table name if we need to.
Anyway, i don't have a choice here, i have to use AO, so now i need to know how i can :
By the way, if AO changes the way it generates the table names, upgrade will become a problem, because it won't find the existing table after the upgrade, so i doubt they'll change it before a real major version.
So if someone knows how i can access my table name or specify it, i would appreciate the help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
After all this time, there still seems to be no solution for this. It seems the way to go is avoid complex SQL queries and instead process the data on Java side - as long as the amount of data you need to fetch is within reasonable dimensions of course that is.
An ORM should make easy things easy and complex things possible. AO unfortunately fails to deliver on the second part.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.