You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "arathi m (JIRA)" <ji...@apache.org> on 2015/06/08 23:26:00 UTC

[jira] [Resolved] (OLINGO-688) Wrong values for autogenerated fields in response for insert entities

     [ https://issues.apache.org/jira/browse/OLINGO-688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

arathi m resolved OLINGO-688.
-----------------------------
       Resolution: Not A Problem
    Fix Version/s: V2 2.0.4

This issue is not a bug. By adding the following JPA annotation to my id field @GeneratedValue(strategy=GenerationType.IDENTITY),

I could fix the issue and the response now contains the right id value.

For date fields, adding the following annotation
@Temporal(TemporalType.TIMESTAMP) to the field and adding method
 @PrePersist
	  void createdAt() {
	    this.datecreated =   new Date();
	  }

to the entity fixed the issue.

> Wrong values for autogenerated fields in response for insert entities
> ---------------------------------------------------------------------
>
>                 Key: OLINGO-688
>                 URL: https://issues.apache.org/jira/browse/OLINGO-688
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-jpa
>    Affects Versions: V2 2.0.3
>            Reporter: arathi m
>             Fix For: V2 2.0.4
>
>
> Upon inserting an entity using Olinga-data2 based JPA processor, I get back a response. This response contains value "0" for my id column(which maps to the id(primary key) of my MYSQL table column which is autogenerated). But my DB table has the correct id value.
> I get back an exception if I have other columns like datecreated, which are again autogenerated by the DB upon insert.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)