All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.tuple.UpdateTimestampGeneration Maven / Gradle / Ivy

There is a newer version: 6.6.2.Final
Show newest version
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.tuple;

import org.hibernate.Internal;
import org.hibernate.Remove;
import org.hibernate.annotations.SourceType;
import org.hibernate.annotations.UpdateTimestamp;
import org.hibernate.dialect.Dialect;

/**
 * Value generation implementation for {@link UpdateTimestamp}, no longer used.
 *
 * @author Gunnar Morling
 *
 * @deprecated use {@link org.hibernate.generator.internal.CurrentTimestampGeneration}
 */
@Internal
@Deprecated(since = "6.2") @Remove
public class UpdateTimestampGeneration implements AnnotationValueGeneration {

	private ValueGenerator generator;

	@Override
	public void initialize(UpdateTimestamp annotation, Class propertyType) {
		if ( annotation.source() == SourceType.VM ) {
			generator = TimestampGenerators.get( propertyType );
		}
	}

	@Override
	public GenerationTiming getGenerationTiming() {
		return GenerationTiming.ALWAYS;
	}

	@Override
	public ValueGenerator getValueGenerator() {
		return generator;
	}

	@Override
	public boolean referenceColumnInSql() {
		return false;
	}

	@Override
	public String getDatabaseGeneratedReferencedColumnValue() {
		return "current_timestamp";
	}

	@Override
	public String getDatabaseGeneratedReferencedColumnValue(Dialect dialect) {
		return dialect.currentTimestamp();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy