title: convert java.sql.Timestamp to javax.xml.datatype.XMLGregorianCalendar without losing nanos
body: <p>What's the cleanest way to convert <code>java.sql.Timestamp</code> to <code>javax.xml.datatype.XMLGregorianCalendar</code>?</p>
  
  <p>Given that <code>XMLGregorianCalendar</code> has <code>BigDecimal</code> precision for fractional seconds there's no loss of precision, however I'm not sure what time zone I should set at the <code>XMLGregorianCalendar</code> object given that <code>java.sql.Timestamp</code> is time-zone independent.</p>
  
  <p>There is an answer on SO on <a href="https://stackoverflow.com/q/835889/274677">how to convert <code>java.util.Date</code> to <code>XMLGregorianCalendar</code></a> so I could cast my <code>Timestamp</code> to <code>java.util.Date</code> but that would lead to loss of precision in the sub-millisecond range which is unnecessary as the target datatype (<code>XMLGregorianCalendar</code>) can hold the nanoseconds component of the source datatype (<code>Timestamp</code>).</p>