Hibernate ORM DateTypeDescriptor - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM DateTypeDescriptor class.

This code example shows how to use the following methods:
/** 
 * Converts a {@link Date} into a {@link String} representing a timestamp. 
 * 
 * @author Davide D'Alto <davide@hibernate.org> 
 */ 
public class TimestampDateTypeDescriptor extends DateTypeDescriptor {
 
	public static final TimestampDateTypeDescriptor INSTANCE = new TimestampDateTypeDescriptor();
 
	@Override 
	public Date fromString(String string) {
		return CalendarTimeZoneDateTimeTypeDescriptor.INSTANCE.fromString( string ).getTime();
	} 
 
	@Override 
	public String toString(Date value) {
		Calendar cal = Calendar.getInstance();
		cal.setTime( value );
		return CalendarTimeZoneDateTimeTypeDescriptor.INSTANCE.toString( cal );
	} 
Full Snippet Info
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java