Siena CRUD One to Many on the Google App Engine (GAE) not working

388 views
Skip to first unread message

Mahamad El Tanahy

unread,
Mar 15, 2012, 8:37:26 AM3/15/12
to play-fr...@googlegroups.com
Hi All,

Would be great if someone could help with this.

I am trying to setup a one to many relationship in Play using Siena, Siena CRUD and the Google App Engine

At the moment, I've setup the following:
- Play v1.2.4
- Siena v2.0.7
- CrudSiena v2.0.2
- GAE v1.6.0

When I create a CRUD object with fields, or many-to-one relationships, everything works fine in the created CMS.  However, when i try and create a One to Many, for some reason, the whole object is no longer saving using the Siena CRUD CMS.

What I get on the one to many multi-select box is:

Please save it once before selecting employees

And the object just can't save anymore.  Saving just shows "Please correct errors" 

My object Employee is as follows:

package models;

import java.util.Date;

import play.data.binding.As;

import siena.Column;

import siena.DateTime;

import siena.Filter;

import siena.Generator;

import siena.Id;

import siena.Index;

import siena.Max;

import siena.Model;

import siena.NotNull;

import siena.Query;

import siena.Table;

@Table("employees")

public class Employee extends Model {

        @Id(Generator.AUTO_INCREMENT)

        public Long id

        @Column("first_name")

        @Max(100) @NotNull

        public String firstName;      

        public Date firstDate;

        @Column("boss"

        @Index("boss_index")

        public Employee boss;


        @Filter("boss")

        public Query<Employee> employees;

               

        public String toString() {

        return firstName;

        }

        

}


If anyone has an answer, it'd be much appreciated.  Seriously considering the Play Framework, and from what I see it looks great, but our main reason for wanting to use it is the CMS generation (which would save us a hell of a lot of time)

Cheers,




Pascal Voitot Dev

unread,
Mar 15, 2012, 10:28:24 AM3/15/12
to play-fr...@googlegroups.com
if you don't select any employee and save once, does it work?





--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/NR38LV1tpegJ.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Mahamad El Tanahy

unread,
Mar 15, 2012, 10:38:41 AM3/15/12
to play-framework
Unfortunately not. Sometimes the list is enabled, and sometimes it's
disabled. Either way, nothing can get saved and keep on getting the
error.


On Mar 15, 4:28 pm, Pascal Voitot Dev <pascal.voitot....@gmail.com>
wrote:

Mahamad El Tanahy

unread,
Mar 15, 2012, 10:45:18 AM3/15/12
to play-framework
I haven't been able to see errors in the console either
unfortunately :-(

On Mar 15, 4:38 pm, Mahamad El Tanahy <mahamad.el.tan...@gmail.com>
wrote:
> Unfortunately not.  Sometimes the list is enabled, and sometimes it's
> disabled.  Either way, nothing can get saved and keep on getting the
> error.
>
> On Mar 15, 4:28 pm, Pascal Voitot Dev <pascal.voitot....@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > if you don't select any employee and save once, does it work?
>
> > On Thu, Mar 15, 2012 at 1:37 PM,MahamadEl Tanahy <

Pascal Voitot Dev

unread,
Mar 15, 2012, 10:45:48 AM3/15/12
to play-fr...@googlegroups.com
do you

Pascal Voitot Dev

unread,
Mar 15, 2012, 10:46:03 AM3/15/12
to play-fr...@googlegroups.com
do you run locally or on GAE directly?

Mahamad El Tanahy

unread,
Mar 15, 2012, 10:47:27 AM3/15/12
to play-framework
I am running it locally.

On Mar 15, 4:46 pm, Pascal Voitot Dev <pascal.voitot....@gmail.com>
wrote:

Pascal Voitot Dev

unread,
Mar 15, 2012, 10:53:35 AM3/15/12
to play-fr...@googlegroups.com
It's strange because it works quite well in GAE in our Siena sample app...

http://mandubian-siena.appspot.com/admin/

You can create Employees to see it work.

are you sure you use GAE (no db=mem in your application.conf) ?

Pascal

Mahamad El Tanahy

unread,
Mar 15, 2012, 10:58:32 AM3/15/12
to play-framework
Yeah I just checked that, it works fine on there.

I have checked that there is nothing like that on my application.conf.

BTW, I'm running this through Eclipse.

Pasted it below:

# This is the main configuration file for the application.
# ~~~~~
application.name=play1

# Application mode
# ~~~~~
# Set to dev to enable instant reloading and other development help.
# Otherwise set to prod.
application.mode=dev
%prod.application.mode=prod

# Secret key
# ~~~~~
# The secret key is used to secure cryptographics functions
# If you deploy your application to several instances be sure to use
the same key !
application.secret=NTmeD00JSvNLnackFztL9CIDIhQaXPHAqq7tCOACS779QZsUqyoehow5q58Yawbs

# i18n
# ~~~~~
# Define locales used by your application.
# You can then place localized messages in conf/messages.{locale}
files
# application.langs=fr,en,ja

# Date format
# ~~~~~
date.format=yyyy-MM-dd
# date.format.fr=dd/MM/yyyy

# Server configuration
# ~~~~~
# If you need to change the HTTP port, uncomment this (default is set
to 9000)
# http.port=9000
#
# By default the server listen for HTTP on the wilcard address.
# You can restrict this.
# http.address=127.0.0.1
#
# Use this if you don't host your Play application at the root of the
domain
# you're serving it from. This parameter has no effect when deployed
as a
# war, because the path will be handled by the application server.
# http.path=/

# Session configuration
# ~~~~~~~~~~~~~~~~~~~~~~
# By default, session will be written to the transient PLAY_SESSION
cookie.
# The cookies are not secured by default, only set it to true
# if you're serving your pages through https.
# application.session.cookie=PLAY
# application.session.maxAge=1h
# application.session.secure=false

# Session/Cookie sharing between subdomain
# ~~~~~~~~~~~~~~~~~~~~~~
# By default a cookie is only valid for a specific domain. By setting
# application.defaultCookieDomain to '.example.com', the cookies
# will be valid for all domains ending with '.example.com', ie:
# foo.example.com and bar.example.com
# application.defaultCookieDomain=.example.com

# JVM configuration
# ~~~~~
# Define which port is used by JPDA when application is in debug mode
(default is set to 8000)
# jpda.port=8000
#
# Java source level => 1.5, 1.6 or 1.7 (experimental)
# java.source=1.5

# Log level
# ~~~~~
# Specify log level for your application.
# If you want a very customized log, create a log4j.properties file in
the conf directory
# application.log=INFO
#
# More logging configuration
# application.log.path=/log4j.properties
# application.log.system.out=off

# Database configuration
# ~~~~~
# Enable a database engine if needed.
#
# To quickly set up a development database, use either:
# - mem : for a transient in memory database (H2 in memory)
# - fs : for a simple file written database (H2 file stored)
# db=mem
#
# To connect to a local MySQL5 database, use:
# db=mysql://user:pwd@host/database
#
# To connect to a local PostgreSQL9 database, use:
# db=postgres://user:pwd@host/database
#
# If you need a full JDBC configuration use the following :
# db.url=jdbc:postgresql:database_name
# db.driver=org.postgresql.Driver
# db.user=root
# db.pass=secret
#
# Connections pool configuration :
# db.pool.timeout=1000
# db.pool.maxSize=30
# db.pool.minSize=10
#
# If you want to reuse an existing Datasource from your application
server, use:
# db=java:/comp/env/jdbc/myDatasource
#
# When using an existing Datasource, it's sometimes needed to destroy
it when
# the application is stopped. Depending on the datasource, you can
define a
# generic "destroy" method :
# db.destroyMethod=close

# JPA Configuration (Hibernate)
# ~~~~~
#
# Specify the custom JPA dialect to use here (default to guess):
# jpa.dialect=org.hibernate.dialect.PostgreSQLDialect
#
# Specify the ddl generation pattern to use. Set to none to disable
it
# (default to update in DEV mode, and none in PROD mode):
# jpa.ddl=update
#
# Debug SQL statements (logged using DEBUG level):
# jpa.debugSQL=true
#
# You can even specify additional hibernate properties here:
# hibernate.use_sql_comments=true
# ...
#
# Store path for Blob content
attachments.path=data/attachments

# Memcached configuration
# ~~~~~
# Enable memcached if needed. Otherwise a local cache is used.
# memcached=enabled
#
# Specify memcached host (default to 127.0.0.1:11211)
# memcached.host=127.0.0.1:11211
#
# Or you can specify multiple host to build a distributed cache
# memcached.1.host=127.0.0.1:11211
# memcached.2.host=127.0.0.1:11212
#
# Use plain SASL to authenticate for memcached
# memcached.user=
# memcached.password=

# HTTP Response headers control for static files
# ~~~~~
# Set the default max-age, telling the user's browser how long it
should cache the page.
# Default is 3600 (one hour). Set it to 0 to send no-cache.
# This is only read in prod mode, in dev mode the cache is disabled.
# http.cacheControl=3600

# If enabled, Play will generate entity tags automatically and send a
304 when needed.
# Default is true, set it to false to deactivate use of entity tags.
# http.useETag=true

# Custom mime types
# mimetype.xpi=application/x-xpinstall

# WS configuration
# ~~~~~
# Default engine is Async Http Client, uncomment to use
# the JDK's internal implementation
# webservice = urlfetch
# If you need to set proxy params for WS requests
# http.proxyHost = localhost
# http.proxyPort = 3128
# http.proxyUser = jojo
# http.proxyPassword = jojo

# Mail configuration
# ~~~~~
# Default is to use a mock Mailer
mail.smtp=mock

# Or, specify mail host configuration
# mail.smtp.host=127.0.0.1
# mail.smtp.user=admin
# mail.smtp.pass=
# mail.smtp.channel=ssl

# Url-resolving in Jobs
# ~~~~~~
# When rendering templates with reverse-url-resoling (@@{..}) in Jobs
(which do not have an inbound Http.Request),
# ie if sending a HtmlMail, Play need to know which url your users use
when accessing your app.
# %test.application.baseUrl=http://localhost:9000/
# %prod.application.baseUrl=http://www.yourdomain.com/

# Jobs executor
# ~~~~~~
# Size of the Jobs pool
# play.jobs.pool=10

# Execution pool
# ~~~~~
# Default to 1 thread in DEV mode or (nb processors + 1) threads in
PROD mode.
# Try to keep a low as possible. 1 thread will serialize all requests
(very useful for debugging purpose)
# play.pool=3

# Open file from errors pages
# ~~~~~
# If your text editor supports opening files by URL, Play! will
# dynamically link error pages to files
#
# Example, for textmate:
# play.editor=txmt://open?url=file://%s&line=%s

# Testing. Set up a custom configuration for test mode
# ~~~~~
#%test.module.cobertura=${play.path}/modules/cobertura
#%test.application.mode=dev
#%test.db.url=jdbc:h2:mem:play;MODE=MYSQL;LOCK_MODE=0
#%test.jpa.ddl=create
#%test.mail.smtp=mock

# Additional modules
# ~~~~~
# A module is another play! application. Add a line for each module
you want
# to add to your application. Module paths are either absolutes or
relative to
# the application root.
#
# - deprecated
# --- GAE Module ---
module.gae=${play.path}/modules/gae-1.6.0
# ---- Siena module ----
module.siena=${play.path}/modules/siena-2.0.7
# -- Siena CRUD Module ----
module.crudsiena=${play.path}/modules/crudsiena-2.0.2



On Mar 15, 4:53 pm, Pascal Voitot Dev <pascal.voitot....@gmail.com>
wrote:

Pascal Voitot Dev

unread,
Mar 15, 2012, 11:03:36 AM3/15/12
to play-fr...@googlegroups.com
could you please remove
module.gae=${play.path}/
modules/gae-1.6.0

# ---- Siena module ----
module.siena=${play.path}/modules/siena-2.0.7
# -- Siena CRUD Module ----
module.crudsiena=${play.path}/modules/crudsiena-2.0.2

and put the dependencies in the dependencies.yml ?

Mahamad El Tanahy

unread,
Mar 15, 2012, 11:04:08 AM3/15/12
to play-fr...@googlegroups.com
Where can I find the exact code for the demo you have at:


I had pasted some of the code from it which wasn't working.

Mahamad El Tanahy

unread,
Mar 15, 2012, 11:12:09 AM3/15/12
to play-fr...@googlegroups.com
Same issue.

The contents of my dependencies file are:

require:

    - play -> play [1.2.4,)

    - play -> gae [1.6.0,)

    - play -> crudsiena [2.0.2,)

    - play -> siena [2.0.7,)


This is what comes out in the console on loading:


Listening for transport dt_socket at address: 8000

17:08:40,161 INFO  ~ Starting /Users/X/Workspaces/play/play1

17:08:40,302 INFO  ~ Module crudsiena is available (/Users/X/Development/play-1.2.4/modules/crudsiena-2.0.2)

17:08:40,303 INFO  ~ Module gae is available (/Users/X/Development/play-1.2.4/modules/gae-1.6.0)

17:08:40,304 INFO  ~ Module siena is available (/Users/X/Development/play-1.2.4/modules/siena-2.0.7)

17:08:42,126 WARN  ~ 

17:08:42,126 WARN  ~ Google App Engine module

17:08:42,126 WARN  ~ ~~~~~~~~~~~~~~~~~~~~~~~

17:08:42,126 WARN  ~ No Google App Engine environment found. Setting up a development environement

17:08:42,532 WARN  ~ Don't forget to define your GAE application id in the 'war/WEB-INF/appengine-web.xml' file

17:08:42,532 WARN  ~ 

17:08:42,532 WARN  ~ You're running Play! in DEV mode

17:08:42,830 INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...

17:09:02,976 INFO  ~ GAE environment detected

17:09:03,945 INFO  ~ Application 'play1' is now started !

17:09:30,235 INFO  ~ Local Datastore initialized: 

Type: Master/Slave

Storage: /Users/moe/Workspaces/play/play1/tmp/datastore

17:09:30,484 INFO  ~ Time to load datastore: 249 ms

17:09:31,058 INFO  ~ GAE environment detected

17:09:37,098 INFO  ~ GAE environment detected



On Thursday, March 15, 2012 5:03:36 PM UTC+2, Pascal wrote:
could you please remove
module.gae=${play.path}/
modules/gae-1.6.0
# ---- Siena module ----
module.siena=${play.path}/modules/siena-2.0.7
# -- Siena CRUD Module ----
module.crudsiena=${play.path}/modules/crudsiena-2.0.2

and put the dependencies in the dependencies.yml ?


On Thu, Mar 15, 2012 at 3:58 PM, Mahamad El Tanahy
Yeah I just checked that, it works fine on there.

> > > >> > > > To unsubscribe from this group, send email to

> > > >> > > > For more options, visit this group at
> > > >> > > >http://groups.google.com/group/play-framework?hl=en.
>
> > > >> --
> > > >> You received this message because you are subscribed to the Google
> > Groups
> > > >> "play-framework" group.
> > > >> To post to this group, send email to play-framework@googlegroups.com.

> > > >> To unsubscribe from this group, send email to

> > > >> For more options, visit this group at
> > > >>http://groups.google.com/group/play-framework?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "play-framework" group.
> > To post to this group, send email to play-framework@googlegroups.com.

> > To unsubscribe from this group, send email to

> > For more options, visit this group at
> >http://groups.google.com/group/play-framework?hl=en.

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To post to this group, send email to play-framework@googlegroups.com.
To unsubscribe from this group, send email to play-framework+unsubscribe@googlegroups.com.

Pascal Voitot Dev

unread,
Mar 15, 2012, 11:12:14 AM3/15/12
to play-fr...@googlegroups.com
https://github.com/mandubian/play-crud-siena/tree/master/samples-and-tests/crudsienatest

Here you can find this sample app!
If you could try this app with the same versions of modules as yours.

Pascal

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/HMqPVK2mr8kJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.

Pascal Voitot Dev

unread,
Mar 15, 2012, 2:13:44 PM3/15/12
to play-fr...@googlegroups.com
I confirm the pb...
I need to investigate!
Certainly something linked to play1.2.4 or something like that!

pascal

To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/D4xjf37-uS4J.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.

Mahamad El Tanahy

unread,
Mar 15, 2012, 3:47:31 PM3/15/12
to play-fr...@googlegroups.com
I'll try them now (sorry, had to rush off to a meeting)

Can you kindly let me know which versions of Play, Siena and CrudSiena definitely work together on the GAE (like the one you created in the example?)


On Thursday, March 15, 2012 5:12:14 PM UTC+2, Pascal wrote:
https://github.com/mandubian/play-crud-siena/tree/master/samples-and-tests/crudsienatest

Here you can find this sample app!
If you could try this app with the same versions of modules as yours.

Pascal


To post to this group, send email to play-framework@googlegroups.com.
To unsubscribe from this group, send email to play-framework+unsubscribe@googlegroups.com.

Pascal Voitot Dev

unread,
Mar 15, 2012, 6:46:08 PM3/15/12
to play-fr...@googlegroups.com
I just pushed a patch for this problem (linked to a modification in binding prefixes in play1.2.4).
I can't deliver modules right now because there is a problem on Module site right now (play team is aware about it). So if you want to test, please checkout the code.
 
regards
Pascal

To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/1OrcpZa7SgIJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.

Mahamad El Tanahy

unread,
Mar 16, 2012, 5:20:14 PM3/16/12
to play-fr...@googlegroups.com
Hi Pascal,

I've managed to get your example by downgrading the versions to:

play 1.2.1
crudsiena 2.0.0
siena 2.0.0
gae 1.4

I'm not familiar with git repo's, so it's going to take me sometime to figure out how to "checkout" the code from it.  (I'm a subversion user still!)

Is there any chance you can provide another method for me to get the patch? (so I can stick to the latest libraries - play 1.2.4 mainly)  - just until I figure out git and get the source code?

Seriously appreciate the speed of help on this btw - your a star.

Moe


On Friday, March 16, 2012 12:46:08 AM UTC+2, Pascal wrote:
I just pushed a patch for this problem (linked to a modification in binding prefixes in play1.2.4).
I can't deliver modules right now because there is a problem on Module site right now (play team is aware about it). So if you want to test, please checkout the code.
 
regards
Pascal

On Thu, Mar 15, 2012 at 8:47 PM, Mahamad El Tanarote:

Pascal Voitot Dev

unread,
Mar 16, 2012, 5:39:52 PM3/16/12
to play-fr...@googlegroups.com
Hi,
Don't use play 1.2.1, it's quite old with some bugs and security issues.

I''ve built the module and uploaded it there:
https://github.com/downloads/mandubian/play-crud-siena/play-crud-siena-2.0.3.zip

You can put it in your PLAY_PATH/modules and try to run "play deps" from your app.

regards
Pascal


To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/DwjaLuWck7oJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.

Mahamad El Tanahy

unread,
Mar 16, 2012, 6:31:14 PM3/16/12
to play-fr...@googlegroups.com
You're an absolute star.. will check it out and let you know


On Friday, March 16, 2012 11:39:52 PM UTC+2, Pascal wrote:
Hi,
Don't use play 1.2.1, it's quite old with some bugs and security issues.

I''ve built the module and uploaded it there:
https://github.com/downloads/mandubian/play-crud-siena/play-crud-siena-2.0.3.zip

You can put it in your PLAY_PATH/modules and try to run "play deps" from your app.

regards
Pascal


On Fri, Mar 16, 2012 at 10:20 PM, Mahamad El Tanahy
Hi Pascal,

Pascal Voitot Dev

unread,
Mar 16, 2012, 6:32:01 PM3/16/12
to play-fr...@googlegroups.com
I'm not a star, you're just lucky I had a few minutes to help you ;););)


To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/hRsWPu2R608J.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.

Mahamad El Tanahy

unread,
Mar 16, 2012, 6:41:34 PM3/16/12
to play-fr...@googlegroups.com
Works like a charm! :-)

Anyone working this late on a Friday night/Saturday morning deserves some appreciation!

Thanks again.


On Saturday, March 17, 2012 12:32:01 AM UTC+2, Pascal wrote:
I'm not a star, you're just lucky I had a few minutes to help you ;););)


Reply all
Reply to author
Forward
0 new messages