Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 80ad057233ad2035c3c6a7393c4137b7544734e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
##included template. Generates the @Basic, @Id, @Version annotations.
##Assumes that the context has a "column" object
##
#set ($mappingKind = $column.mappingKind)
#if ($mappingKind == "id")
	@Id
#set ($idGenerator = $table.idGenerator)
#if ($idGenerator == "auto")
#set ($generationType = "GenerationType.AUTO")
#elseif ($idGenerator == "identity")
#set ($generationType = "GenerationType.IDENTITY")
#elseif ($idGenerator == "sequence")
#set ($generationType = "GenerationType.SEQUENCE")
#elseif ($idGenerator == "table")
#set ($generationType = "GenerationType.TABLE")
#else
#set ($generationType = "")
#end
#if ($idGenerator == "sequence" )
#set ($generatorName = "${table.name.toUpperCase()}_${column.propertyName.toUpperCase()}_GENERATOR")
#if( $table.formattedSequence != "" )
	@SequenceGenerator(name="$generatorName", sequenceName="$table.formattedSequence")
#else
	@SequenceGenerator(name="$generatorName" )
#end	
	@GeneratedValue(strategy=$generationType, generator="$generatorName")
#elseif ($generationType != "")
	@GeneratedValue(strategy=$generationType)
#end      
#elseif ($mappingKind == "version")
	@Version
#else
##DEFAULT is @Basic, no need to generate
#end

Back to the top