I'm using OpenJPA in Geronimo 2.1.3 and I have a timestamp column in a
MySQL database, and even though the data in the table is right, every time
I query the entity it returns 'null' instead of the timestamp data.
Following is my entity:

package com.pubint.ejb.entity;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;


@Entity
@Table(name="compAttribValue")
@XmlRootElement(name="currentValue")
@XmlType(propOrder = {})
@XmlAccessorType(XmlAccessType.PROPERTY)
public class CompAttribValue implements Serializable {
    private static final long serialVersionUID = 1L;

    private long id;
    private long parentID;

    private long valueID;
    private String valueData;

    private Timestamp valueChangeDate;

    private AttribValue value;

    public CompAttribValue() {

    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="id")
    @XmlAttribute(name="id")
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Column(name="xCAID")
    @XmlTransient
    public long getParentID() {
        return parentID;
    }

    public void setParentID(long id) {
        parentID = id;
    }

    @Column(name="valueID")
    @XmlAttribute(name="valueID")
    public long getValueID() {
        return valueID;
    }

    public void setValueID(long valueID) {
        this.valueID = valueID;
    }

    @Column(name="valueData")
    @XmlTransient
    public String getVData() {
        return valueData;
    }

    public void setVData(String valueData) {
        this.valueData = valueData;
    }

    @Transient
    @XmlElement(name="valueData")
    public String getValueData() {
        String returnValue;

        if (getValueID() != 0) {
            returnValue = getValue().getValueData();
        } else {
            returnValue = getVData();
        }

        return returnValue;
    }

    public void setValueData(String data) {
        setVData(data);
    }

    @Column(name="valueChanged")
    @Temporal(TemporalType.TIMESTAMP)
    public Timestamp getValueChangeDate() {
        return valueChangeDate;
    }

    public void setValueChangeDate(Timestamp date) {
        //
    }

    @OneToOne(fetch=FetchType.EAGER)
    @JoinColumn(name="valueID")
    public AttribValue getValue() {
        return value;
    }

    public void setValue(AttribValue value) {
        this.value = value;
    }
}

Anyone know what could help?

Thanks,
Scott

Reply via email to