Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Automatically generated table maps java.util.Date to VARCHAR(Automatically generated table maps java.util.Date to VARCHAR)
Automatically generated table maps java.util.Date to VARCHAR [message #1106239] Tue, 10 September 2013 21:43
Volker Demel is currently offline Volker DemelFriend
Messages: 1
Registered: September 2013
Junior Member
Sorry if I ask a question that's been answered before. My googling skills were not sufficient to find it.

If class is of type @Embeddable the wrong data type is generated in database.

Example
@Entity
@Table(name = "MY_ENTITIES")
public class MyEntity {
    @Id
    @GeneratedValue
    @Column(name = "ENT_ID")
    private Integer          myId;

    @ElementCollection
    @CollectionTable(name = "MY_EMBEDDED", joinColumns = @JoinColumn(name = "BED_ENT_ID"))
    private List<MyEmbedded> myEmbeddedList;

    @Column(name = "ENT_DATE_VALUE")
    @Temporal(TemporalType.TIMESTAMP)
    private java.util.Date   myDateValue;
}

works fine, ENT_DATA_VALUE is type DATETIME
CREATE TABLE MY_ENTITIES (
    ENT_ID INTEGER NOT NULL,
    ENT_DATE_VALUE DATETIME,
    PRIMARY KEY (ENT_ID)
);

while this
@Embeddable
public class MyEmbedded {
    @Column(name = "EMB_NAME")
    private String myName;

    @Column(name = "EMB_DATE_VALUE")
    @Temporal(TemporalType.TIMESTAMP)
    private java.util.Date   myDateValue;
}


uses VARCHAR2 for EMB_DATA_VALUE
CREATE TABLE MY_EMBEDDED (
    EMB_DATE_VALUE VARCHAR(255),
    EMB_NAME VARCHAR(255),
    BED_ENT_ID INTEGER
);


Is this something I have overlooked or just a bug in EclipseLink?

------------------
Eclipse: Juno Service Release 2
javax.persistence: 2.0.4
org.eclipse.persistence.core: 2.4.0
org.eclipse.persistence.jpa: 2.4.0

Previous Topic:JPA hierarchical queries
Next Topic:how to remove xsd xsi xsi:type from generated xml element
Goto Forum:
  


Current Time: Sun Dec 21 15:16:00 GMT 2014

Powered by FUDForum. Page generated in 0.01824 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software