How to configure composite primary key on an entity?
Community moderators have prevented the ability to post new answers.
in AO Version 1.2.0 there is support for composite indexes:
import net.java.ao.Entity; import net.java.ao.schema.Index; import net.java.ao.schema.Indexes; @Indexes({ @Index(name = "names", methodNames = {"getFirstName", "getLastName"}), @Index(name = "age", methodNames = "getAge") }) public interface Person extends Entity { public String getFirstName(); public void setFirstName(String firstName); public void setLastName(String lastName); public String getLastName(); public int getAge(); public void setAge(int age); }
Hi Arthur,
I tried using creating the same entity mentioned above in my plugin. AO version 1.2.0
But still table was created without indexes.
There were no indexes created in DB. Let me if I am making a mistake or missing any step.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think you need to explain that in a lot more detail. The last kitchen designer I spoke to said almost the same thing and that has nothing to do with JIRA
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
AO auto assigns ID field as primary key but I want to set 3 columns as primary key on the table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can't do that, the ID is a unique identifier handled by JIRA and the AO code, it needs it to be of a certain format. If you really desperately need to do it, you'd need to change core code in JIRA's AO implementation to support it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If that is true, then AO is not a relational database interface, since composite primary keys is one of a key features of relational databases. You can find composite keys in almost any software which is persisting data to a database. Imagine if you wanted to migrate such software to use active objects without support of composite keys. You would have to rewrite your entire model and business logic too. There must be a way to do that in AO. All kinds of databases that i heard of are supporting composite keys. This is true even for the in-memory-database hsql which is used by JIRA by default.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're confusing database with datastore. JIRA uses databases as datastores (and takes advantage of some low-level features like indexing). It does not pretend to use it as a relational database. It's for storing data.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nic Brough [Adaptavist]
in the active objects bundle for some reason an annotation @PrimaryKey exists.
Its Javadoc is saying:
Marks a method such that the corresponding database field will be the primary key for the table in question. Using this annotation, it is possible to specify arbitrary primary key field names and types.
The logic in both migrations and entity invocation handling assumes that there is only a single primary key per entity type. If the entity type does not contain exactly one field (may be more than one method) as a primary key, odd errors will ensue.
Quite unclear.
On one hand it is saying that this annotation is used to define primary key field names and types, suggesting that multiple fields are possible.
On the other hand it is saying that AO is assuming that there is only a single primary key per entity type. And that odd errors will ensue if there is more then one.
Sounds like the devs of AO didn't see the need of composite primary keys and din't realy know whats going to happen and why its going to happen when you use their PrimaryKey annotation on multiple methods of same entity.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I understand that, but you're missing the point again. It's not a relational database.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It doesn't matter if it is a relational database.I just said, that if there is no support for composite keys in AO, you cannot call it like so.
The lack of support for composite primary keys just leaves you without many options when designing persistence model for your plugins.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not sure what you're asking now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
nothing, just commenting your anwser.
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.