Frequently Asked Questions
UNDER RE-CONSTRUCTION... Will evolve soon!
New manuals page also available on Siena Github Wiki
Please find your question here. If don't find the answer, feel free to join
the mailing list and
ask your question there.
- Is siena another ORM?
- Not exactly. It is not an ORM (Object-relational mapping tool) because it is not
only intended to be used in relational databases. Siena is a library for persistence
that works in relational databases and NoSQL databases as well.
- Does siena support JOINs?
- Yes but not all JOINs (mainly only LEFT-JOIN for the time being). NoSQL doesn't support JOIN in general whereas SQL do.
So, providing a JOIN feature for NoSQL is just doing some hidden requests to simulate the JOIN.
Nevertheless, Siena provides LEFT-JOIN for One2One relation for GAE and it tries to do it in the most optimized way.
In NoSQL, instead of using complicated JOINs, you can use denormalization and redundancy which is often a good manner.
Siena has some features that will help you with this such as embedding and aggregation.
- How can I implement one-to-many relationships?
- Check the Getting started guide,
the section that talks about "Working with relationships".
New Owner/Aggregated relation are coming soon with syntactic sugar One<T>/Many<T> that will make the relation clear and easy to use.
- How can I implement many-to-many relationships?
- Just use denormalization and create an intermediate class that represents the many-to-many relationship.
Then implement two one-to-many relationships. Check the
Getting started guide,
the section that talks about "Working with relationships".
- Does Siena support foreign keys?
- Siena supports relationships and can work in relational databases. But ensuring
data consistency depends on your database engine. In relational databases
you can create your constraints manually. The siena implementation
for relational databases can create the database schema, but doesn't support
creating the foreign keys yet.
- Can siena create and update the database schema?
- The siena implementation
for relational databases can generate the SQL needed to keep in sync
your data model with your database schema. It creates "CREATE TABLE" and "ALTER TABLE", etc.
when needed.
- Does siena support connection pooling?
- The siena implementation
for relational databases supports pluggable
siena.jdbc.ConnectionManager.
You can implement your own. If you are using the Play! framework the best idea is to
implement a ConnectionManager that uses the pooling feature from the framework.
Read how.