I don't know if you fixed this yet? But i had what i think was a similar
problem with java.sql.timestamp. The problem is that JAXB doesn't know how
to unmarshal the object. The solution for me was to annotate the class so
JAXB only read the public fields, and then store the timestamp as a string
value. I could then use the getter and setter methods to get and set
timestamps, but JAXB only had to deal with a string. Maybe you can do
something similar, although a gregoriancalender is a somewhat harder nut to
crack.
Here is one of the classes. Note timecreated, a string that has getter and
setter methods as a timestamp. This is accepted by JAXB, that troublesome
drama queen:)

import java.sql.Timestamp;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import orgserver.common.StatementLoader;
import orgserver.common.exceptions.NoSuchStatementException;
import orgserver.services.interfaces.SystemNotificationInterface;
@XmlAccessorType(XmlAccessType.FIELD) //JAXB only handle fields
/**
 *
 * @author martin
 */
public class SystemNotification implements SystemNotificationInterface{
    @XmlElement(name = "NotificationId", nillable = true, required = false)
    long notificationid;
    @XmlElement(name = "NotificationTargetId", nillable = true, required =
false)
    long notificationtargetid;
    @XmlElement(name = "NotificationTargetUserId", nillable = true, required
= false)
    int targetuserid;
    @XmlElement(name = "NotificationTargetText", nillable = true, required =
false)
    String notificationtarget;
    @XmlElement(name = "NotificationActionText", nillable = true, required =
false)
    String notificationaction;
    @XmlElement(name = "NotificationObjectText", nillable = true, required =
false)
    String notificationobject;
    @XmlElement(name = "NotificationTimeCreated", nillable = true, required
= false)
    String timecreated; //Actually a timestamp value in tostring form
    @XmlElement(name = "NotificationRead", nillable = true, required =
false)
    boolean readbyowner;
    @XmlElement(name = "NotificationTargetType", nillable = true, required =
false)
    Integer notificationtargettype;

    public SystemNotification() {
    }

    public SystemNotification(long notificationid, long
notificationtargetid, int targetuserid, String notificationtarget, String
notificationaction, String notificationobject, Timestamp timecreated,
boolean readbyowner, Integer notificationtargettype) {
        this.notificationid = notificationid;
        this.notificationtargetid = notificationtargetid;
        this.targetuserid = targetuserid;
        this.notificationtarget = notificationtarget;
        this.notificationaction = notificationaction;
        this.notificationobject = notificationobject;
        this.timecreated = timecreated.toString();
        this.readbyowner = readbyowner;
        this.notificationtargettype = notificationtargettype;
    }

    public String getNotificationaction() {
        return notificationaction;
    }

    public void setNotificationaction(String notificationaction) {
        this.notificationaction = notificationaction;
    }

    public String getNotificationobject() {
        return notificationobject;
    }

    public void setNotificationobject(String notificationobject) {
        this.notificationobject = notificationobject;
    }

    public String getNotificationtarget() {
        return notificationtarget;
    }

    public void setNotificationtarget(String notificationtarget) {
        this.notificationtarget = notificationtarget;
    }

    public long getNotificationtargetid() {
        return notificationtargetid;
    }

    public void setNotificationtargetid(long notificationtargetid) {
        this.notificationtargetid = notificationtargetid;
    }

    public boolean isReadbyowner() {
        return readbyowner;
    }

    public void setReadbyowner(boolean readbyowner) {
        this.readbyowner = readbyowner;
    }

    public int getTargetuserid() {
        return targetuserid;
    }

    public void setTargetuserid(int targetuserid) {
        this.targetuserid = targetuserid;
    }

    public Timestamp getTimecreated() { //Create timestamp from string and
return (Watch out for null values)
        if(timecreated == null) return null;
        return Timestamp.valueOf(timecreated);
    }

    public void setTimecreated(Timestamp timecreated) { //Save as string
        this.timecreated = timecreated.toString();
    }

    public Integer getNotificationtargettype() {
        return notificationtargettype;
    }

    public void setNotificationtargettype(Integer notificationtargettype) {
        this.notificationtargettype = notificationtargettype;
    }


    public Integer getNotificationType() {
        return notificationtargettype;
    }

    public long getNotificationId() {
        return notificationid;
    }

    public void setNotificationid(long notificationid) {
        this.notificationid = notificationid;
    }

    public String toString(){
        return getClass().getSimpleName()+" id: "+getNotificationId()+"
target: "+this.getNotificationtargetid()+" user: "+this.getTargetuserid()+"
targettype "+this.getNotificationtargettype()+"
"+this.getNotificationtarget()+" "+this.getNotificationaction()+"
"+this.getNotificationobject()+" "+this.getTimecreated()+" read:
"+this.isReadbyowner();
    }

   
 


}



--
View this message in context: 
http://cxf.547215.n5.nabble.com/XMLGregorianCalendar-problems-tp5713419p5713700.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to