-
Notifications
You must be signed in to change notification settings - Fork 3
/
domainJpaEntityId_java.vm
77 lines (64 loc) · 1.85 KB
/
domainJpaEntityId_java.vm
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#checkId($entity)
#parse("include/init_var_entity.vm")
#parse("include/java_header.vm")
##--------------------------------------------------------------------------------------------------------
package ${target.javaPackageFromFolder($SRC)};
import java.io.Serializable;
#foreach( $import in $java.imports($entity.keyAttributes) )
import $import;
#end
/**
* Composite primary key for entity "${entity.name}" ( stored in table "${entity.databaseTable}" )
*
* @author Telosys
*
*/
## @Embeddable
public class $jpaEntityIdClass implements Serializable {
private static final long serialVersionUID = 1L;
//--- ENTITY KEY ATTRIBUTES
#foreach( $field in $entity.keyAttributes )
## $jpa.embeddedIdAnnotations(4, $field)
private $field.formattedType(10) $field.name ;
#end
/**
* Constructor
*/
public $jpaEntityIdClass() {
super();
}
/**
* Constructor with values
#foreach( $field in $entity.keyAttributes )
* @param $field.name
#end
*/
public ${jpaEntityIdClass}( $fn.argumentsListWithWrapperType($entity.keyAttributes) ) {
super();
#foreach( $field in $entity.keyAttributes )
this.$field.name = $field.name ;
#end
}
//--- GETTERS & SETTERS FOR KEY FIELDS
#foreach( $field in $entity.keyAttributes )
#if ( $field.databaseName )
#end
#if ( $field.setter ) public void ${field.setter}( $field.type value ) {
this.$field.name = value;
}
#end
#if ( $field.getter ) public $field.type ${field.getter}() {
return this.$field.name;
}
#end
#end
//--- equals METHOD
@Override
$java.equalsMethod($jpaEntityIdClass, $entity.keyAttributes )## no EOL
//--- hashCode METHOD
@Override
$java.hashCodeMethod($jpaEntityIdClass, $entity.keyAttributes )## no EOL
//--- toString METHOD
@Override
$java.toStringMethod($entity.keyAttributes, 4)## no EOL
}