ids for this class must be manually assigned before calling save() in CRUD

7,538 views
Skip to first unread message

BakaOnigiri

unread,
Sep 15, 2010, 10:25:50 AM9/15/10
to play-framework
Hello,

I have a simple entity :

@Entity
@Table(name="config")
public class Config extends JPASupport
{
@Id
@Required
public String key;

@Required
public String value;
}


And I have 2 problems :

1 - the CRUD form don't want to show me the field for the value field.

2 - When I click the save button, I have and exception :

Java exception (In {module:crud}/app/controllers/CRUD.java around line
134)
PersistenceException occured :
org.hibernate.id.IdentifierGenerationException: ids for this class
must be manually assigned before calling save(): models.Config


How can I solve this problem ?


Thanks.

Guillaume Bort

unread,
Sep 15, 2010, 10:45:48 AM9/15/10
to play-fr...@googlegroups.com
Which version? Can you try with latest 1.1 beta?

Le 15 sept. 2010 à 16:25, BakaOnigiri <bakao...@gmail.com> a
écrit :

> --
> You received this message because you are subscribed to the Google
> Groups "play-framework" group.
> 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
> .
>

Julien Tournay

unread,
Sep 15, 2010, 10:53:38 AM9/15/10
to play-fr...@googlegroups.com
The class should extends Model no ?
--
Real Programmers don't need comments-- the code is obvious.

BakaOnigiri

unread,
Sep 15, 2010, 11:36:05 AM9/15/10
to play-framework
I was using 1.0.3, tried 1.1b2 and everything works well.

Now I have 2 choices, as I was using multidb module :

1 - backport the corrections from 1.1b2 to 1.0.3
or
2 - update multidb module for 1.1b2


What is the best choice ?


On 15 sep, 16:45, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> Which version? Can you try with latest 1.1 beta?
>
> Le 15 sept. 2010 à 16:25, BakaOnigiri <bakaonig...@gmail.com> a  

BakaOnigiri

unread,
Sep 15, 2010, 11:37:30 AM9/15/10
to play-framework
It is not an obligation, Model is just an helper where on @Id field is
declared, but if you don't need it, you can extends JPASupport, just
as Model does.

On 15 sep, 16:53, Julien Tournay <boudhe...@gmail.com> wrote:
> The class should extends Model no ?
>
> On Wed, Sep 15, 2010 at 4:45 PM, Guillaume Bort <guillaume.b...@gmail.com>wrote:
>
>
>
> > Which version? Can you try with latest 1.1 beta?
>
> >> play-framewor...@googlegroups.com<play-framework%2Bunsu...@googlegroups.com>
> >> .
> >> 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-fr...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > play-framewor...@googlegroups.com<play-framework%2Bunsu...@googlegroups.com>
> > .

Guillaume Bort

unread,
Sep 15, 2010, 12:58:35 PM9/15/10
to play-fr...@googlegroups.com
Update multidb module for 1.1

> 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.
>
>

--
Guillaume Bort, http://guillaume.bort.fr

For anything work-related, use g...@zenexity.fr; for everything else,
write guillau...@gmail.com

Julien Tournay

unread,
Sep 16, 2010, 4:20:37 AM9/16/10
to play-fr...@googlegroups.com
If you declare the id field yourself, you should set the generation strategy no ?
I d'ont know if hibernate use auto generated ids by default.

jto.
Reply all
Reply to author
Forward
0 new messages