01: // $Id: VersionTypeSeedParameterSpecification.java 8513 2005-11-02 18:47:40Z steveebersole $
02: package org.hibernate.param;
03:
04: import org.hibernate.engine.QueryParameters;
05: import org.hibernate.engine.SessionImplementor;
06: import org.hibernate.type.VersionType;
07: import org.hibernate.type.Type;
08: import org.hibernate.param.ParameterSpecification;
09:
10: import java.sql.PreparedStatement;
11: import java.sql.SQLException;
12:
13: /**
14: * Implementation of VersionTypeSeedParameterSpecification.
15: *
16: * @author Steve Ebersole
17: */
18: public class VersionTypeSeedParameterSpecification implements
19: ParameterSpecification {
20:
21: private VersionType type;
22:
23: public VersionTypeSeedParameterSpecification(VersionType type) {
24: this .type = type;
25: }
26:
27: /**
28: * @see org.hibernate.param.ParameterSpecification#bind
29: */
30: public int bind(PreparedStatement statement, QueryParameters qp,
31: SessionImplementor session, int position)
32: throws SQLException {
33: type.nullSafeSet(statement, type.seed(session), position,
34: session);
35: return 1;
36: }
37:
38: public Type getExpectedType() {
39: return type;
40: }
41:
42: public void setExpectedType(Type expectedType) {
43: // expected type is intrinsic here...
44: }
45:
46: public String renderDisplayInfo() {
47: return "version-seed, type=" + type;
48: }
49: }
|