01: package org.hibernate.id.enhanced;
02:
03: import org.hibernate.engine.SessionImplementor;
04: import org.hibernate.dialect.Dialect;
05:
06: /**
07: * Encapsulates definition of the underlying data structure backing a
08: * sequence-style generator.
09: *
10: * @author Steve Ebersole
11: */
12: public interface DatabaseStructure {
13: /**
14: * The name of the database structure (table or sequence).
15: * @return The structure name.
16: */
17: public String getName();
18:
19: /**
20: * How many times has this structure been accessed through this reference?
21: * @return The number of accesses.
22: */
23: public int getTimesAccessed();
24:
25: /**
26: * The configured increment size
27: * @return The configured increment size
28: */
29: public int getIncrementSize();
30:
31: /**
32: * A callback to be able to get the next value from the underlying
33: * structure as needed.
34: *
35: * @param session The session.
36: * @return The next value.
37: */
38: public AccessCallback buildCallback(SessionImplementor session);
39:
40: /**
41: * Prepare this structure for use. Called sometime after instantiation,
42: * but before first use.
43: *
44: * @param optimizer The optimizer being applied to the generator.
45: */
46: public void prepare(Optimizer optimizer);
47:
48: /**
49: * Commands needed to create the underlying structures.
50: * @param dialect The database dialect being used.
51: * @return The creation commands.
52: */
53: public String[] sqlCreateStrings(Dialect dialect);
54:
55: /**
56: * Commands needed to drop the underlying structures.
57: * @param dialect The database dialect being used.
58: * @return The drop commands.
59: */
60: public String[] sqlDropStrings(Dialect dialect);
61: }
|