openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rahul Thakur <rahul.thakur.x...@gmail.com>
Subject Re: Persisting new Entity returns NULL Id
Date Mon, 10 Dec 2007 18:23:20 GMT
I was doing it after the method persisting the Entity returned, but 
forgot to decorate the method with Spring's 
@Transactional(readonly=false), which, I guess, was not causing the 
transaction to commit.

Works now, thanks!

Rahul



Patrick Linskey wrote:
> Hi,
>
>   
>> When I attempt to persist a new instance, I get back a NULL id.
>>     
>
> How are you accessing the ID? Are you doing it before or after the
> transaction commits?
>
> -Patrick
>
> On Dec 7, 2007 8:21 PM, Rahul Thakur <rahul.thakur.xdev@gmail.com> wrote:
>   
>> Hi,
>>
>> I have an persistable entity which has an identifier property setup with
>> following annotations:
>>
>>     @Id
>>     @GeneratedValue( strategy = GenerationType.IDENTITY)
>>     @Column( name = "ID" )
>>     private Long id;
>>
>> When I attempt to persist a new instance, I get back a NULL id.
>>
>> I am not sure if it matters but I am using Spring 2.5 for wiring up
>> application beans and my Store implementation extends from:
>>      org.springframework.orm.jpa.support.JpaDaoSupport
>> to use the JpaTemplate.
>>
>> I am new with openjpa, and appreciate any pointers - where should I
>> start investigating this?
>>
>> Thanks in advance,
>>
>> Rahul
>>
>>
>>     
>
>
>
>   

Mime
View raw message