Questions tagged [siena]

Siena is a persistence API for Java inspired by the Google App Engine Python Datastore trying to draw a bridge between SQL and NoSQL worlds. It provides a Java Object-DB mapping designed following the ActiveRecord pattern which brings a simple and intuitive approach to manage your Java objects with respect to the database entities.

Welcome to Siena project!

Latest tagged version is Siena v1.0.0-b4

Siena is a persistence API for Java inspired by the Google App Engine Python Datastore trying to draw a bridge between SQL and NoSQL worlds. It provides a Java Object-DB mapping designed following the ActiveRecord pattern which brings a simple and intuitive approach to manage your Java objects with respect to the database entities.


Where can you find us also?

  • The main website is http://www.sienaproject.com but the doc is not up-to-date there as it refers to the old version 0.x of Siena.

  • The code trunk is https://github.com/mandubian/siena/

  • We have a IRC channel on freenode:
    • irc server: irc.freenode.net:6667
    • channel: #siena
  • You can contact the main committer of Siena using "mandubian" profile in Github or this email: pascal.voitot.dev@gmail.com


Siena is a single API with many implementations

  • SQL RDBMS (MySQL, Postgres, H2)
  • NoSQL (GAE sync/async for the time being and other implementations are planned such as: MongoDB, SimpleDB, HBase...)


Siena simplifies the transition between NoSQL and SQL

Siena is not meant to mimic a kind of Hibernate for NoSQL+SQL as it would be nonsense. In most cases, a model designed for SQL can be re-used in a NoSQL DB and vice-versa but it might not be optimized for the database. Siena is not meant to modify your model behind your back to optimize it for all the databases because it would be a crazy work. Siena just aims at drawing a bridge between NoSQL/SQL worlds and reducing the effort required when going from one database to the other. It ensures: * You can use the same API for all DB. * The model you design for a RDBMS will work with the same code in a NoSQL database and vice-versa. * Naturally, after migrating, you will optimize your model for the new database based on its specificity. * When you want to use very specific feature of a database, you will naturally use the low-level APIs provided by this DB.


Siena has a development lifecycle driven by practical use-cases and user experience

Siena doesn't try to fit in force and hide all the specific database technical aspects into your Java code. It has certainly been a false and unfulfilled promise of ORM frameworks in general: an object is not really a relational entity and SQL can't be completely hidden behind Java code. Thus, ORM often just moves the problems you had with SQL to problems you have with your ORM framework and unfortunately, you don't control your ORM framework at all as your SQL.

So we try to design Siena (at least as a wishful thinking because it's not an easy and exact process :)) through a process going from the user needs to the technical aspects of SQL/NoSQL databases and not the other way. As an example, when building a web application, you often need to paginate among hundreds of entities by pages of 50 for ex. You really don't care how the DB manages its record offsets for SQL or cursors for GAE, you just want a page of 50 entities and then go to the next page and then go back to the previous page etc... So Siena provides a pagination mechanism which allows exactly this without scratching your head and this mechanism has the same behavior in SQL and NoSQL.

As a consequence, Siena is a bit more than just a Object-Mapping API, it's like a toolbox to help you build your application based on a persistence system.



Siena technical design


A thin layer on top of low-level DB API

Siena is meant to keep the layer between your code and the low-level database APIs as thin as possible in order to make it efficient and not to implement to much technical mechanisms on top of already complex and complete database mechanisms: * For SQL, it directly uses JDBC * For GAE, it directly uses GAE low-level Datastore

The biggest part of Siena DB implementations is : * Mapping from Java types to low level DB types * Business code to manage high level mechanism such as pagination or stateless/stateful modes

Siena core is ONE jar and some tools/modules around this core library

Siena tries to be as simple as possible in its dependencies. For the time being, in order to use Siena with all DB implementations, you just need the siena.jar and the DB Jar(s) (JDBC or GAE) but nothing else. There is no hidden or transitive dependencies on other frameworks or Jars. So you can use Siena in a simple Java application or in a simple web app or in a JEE app.

Our purpose is also to provide tools or integrated modules based on this core library to use Siena in given environments.

The first module developed for Siena is play-siena: the web framework Play! is really great, really fits Siena design and provides a very good test platform.

Siena is stateless by default (but can become stateful if required)

Siena is stateless by default because it really fits the majority of cases and one can use it directly without scratching his head about potential problems of releasing DB resources or committing anything. Moreover, stateless is much easier to use in scalable and distributed infrastructure such as GAE.

Yet, Siena now proposes a new stateful mode to be able to reuse DB resources several times. Thus you can: * create a query with filters and orders and use the same query several keeping last context alive. * iterate through the results while keeping in memory the last position. * etc...

This stateful mode provides some interesting advanced features and we don't know yet all the practices it will bring. Siena is Open Source and is released under the Apache License 2.0.

Siena provides an asynchronous mode (only for GAE for the time being)

This is a really powerful way of retrieving entities from a database. You create a query, you launch it, you do something else and when the result is ready, you get it. Asynchrony is really useful when you run long duration queries and don't want to stop all the current thread while the queries is treated.

Siena provides an easy way to go to asynchronous mode and back to synchronous.

35 questions
26
votes
5 answers

How mature is Ebean or Siena?

In the last time I heard a lot of complaining about Hibernate. And indeed I have some painful experiences with Hibernate too. So I read about Ebean and Siena. Both have interesting approaches. Unfortunately, database access layers are very easy to…
niels
  • 7,144
  • 2
  • 33
  • 56
16
votes
2 answers

How can I do paging with @OneToMany collections

Suppose I have a Post entity and a Comment entity and a one to many relationship: @Entity class Post { ... @OneToMany List comments; ... } How can I achieve paging like this: Post post = //Find the post. return…
Visus Zhao
  • 1,104
  • 2
  • 11
  • 25
4
votes
2 answers

Siena / Play / GAE parses boolean field wrong: 0 = true

I'm having a hard time working with booleans in Siena 2.0.7 and Play 1.2.4. In the constructor of my class I set the boolean to FALSE. Then I save the object. In the datastore viewer I can see the boolean field saved as 0. When I retrieve that row…
4
votes
3 answers

How define the result type of this method?

How do I define the method return type in the following case: working code def deleteInstance(model: String, uid: Long) = model match { case "menu" => Model.all(classOf[Menu]).filter("uid", uid).get().delete() case "articles" =>…
user816472
  • 49
  • 3
3
votes
2 answers

Play! + Siena + GAE + JUnit

I am trying to get some basic unit tests up and running on the Play! framework using the Siena persistence library with GAE as the intended deployment target. I have the project configured properly and can deploy the app to GAE. I created a basic…
Jason Miesionczek
  • 13,718
  • 14
  • 73
  • 108
2
votes
1 answer

How does siena query search work?

I'm looking for a documentation on how to do a query in siena that returns all the elements which contains a string. I tried something like return all().search("nome", query).fetch(); but it returns all the elements, with no filtering.
Maurizio Pozzobon
  • 2,804
  • 7
  • 32
  • 42
2
votes
2 answers

Play Siena failing to connect to MySQL on GAE

I am using play framework 1.2.7, gae module 1.6.0 and siena module 2.0.7 (also tested 2.0.6). This is a simple project that should run in play deployed on App Engine and connect to a MySQL database in Google Cloud SQL. My project runs fine locally…
momo
  • 3,192
  • 6
  • 33
  • 62
2
votes
1 answer

Play Framework's Siena module is erroring out while binding to a @Text field in Cloud SQL on Google App Engine

I am attempting to rewrite Play! framework's YABE tutorial so that it can run on Google App Engine using the Siena module. I am using the following versions of play and modules: Play 1.2.5 crudsiena 2.0.3 siena 2.0.7 gae 1.6.0 I have successfully…
1
vote
1 answer

How to define one to many relation in Siena and GAE?

Suppose I have two domain models Author and Book. So Author can have one or many books. From the documentation for Siena, it seems to suggest something like: public class Author extends Model { @Id public Long id; public String…
ace
  • 12,531
  • 35
  • 100
  • 167
1
vote
1 answer

Cannot configure crudsiena module for play framework 1.2.2

i'm trying to create basic application on Play Frramework(1.2.2) + siena (2.0.2) + crudsiena(2.0.1) + gae(1.4). all of these i got from play's dependency management system. I was follwing sample in documentation and i got an strange error: Not…
1
vote
1 answer

Can't get a string field from an object in another object in siena

I'm having trouble getting a field which is in an object which is inside another object. I can get some fields, but others no. This is the test I created to reproduce this error. public void commentTest(){ try { new…
Maurizio Pozzobon
  • 2,804
  • 7
  • 32
  • 42
1
vote
1 answer

Play Gae persistence not working for Set

This is my User class public class User extends Model { @Id public Long id; public String nome; public String email; public String webId; //ID of the user in the provider website public String passwordHash; public String…
Maurizio Pozzobon
  • 2,804
  • 7
  • 32
  • 42
1
vote
0 answers

PlayFramework+GAE+Siena using Datastore and Cloud SQL simultaneously

Does anyone knows if is there way to use Datastore and Cloud SQL in GAE application simultaneously (PlayFramework 1.2.7 with GAE plugin). E.g. @Table("sometable1") class Model1 extends siena.Model{} @Table("sometable2") class Model2 extends…
1
vote
1 answer

Is there a way *not* to persist a field with Siena

I use siena with google engine. I have a model class with a field (named secret) that I don't want to be persisted. (I don't want the column to be created in the google datastore) Something along the lines of Class person { @Id public Long…
Name is carl
  • 5,393
  • 3
  • 24
  • 43
1
vote
1 answer

InvalidObjectException when getting from SignedObject

I am sending an object encased in a Message object encase in a SignedObject over a TCP connection using an ObjectInputStream. Here's the basic code: Send Object data = someObject; ObjectOutputStream = new…
David K
  • 1,288
  • 16
  • 36
1
2 3