33 * Copyright Red Hat Inc. and Hibernate Authors
44 */
55package org .hibernate .orm .test .annotations .indexcoll .eager ;
6- import java .util .Date ;
7- import java .util .HashMap ;
8- import java .util .Map ;
6+
97import jakarta .persistence .CascadeType ;
108import jakarta .persistence .Column ;
119import jakarta .persistence .ElementCollection ;
2321import jakarta .persistence .MapKeyJoinColumns ;
2422import jakarta .persistence .MapKeyTemporal ;
2523import jakarta .persistence .TemporalType ;
26-
2724import org .hibernate .orm .test .annotations .indexcoll .Gas ;
2825import org .hibernate .orm .test .annotations .indexcoll .GasKey ;
2926
27+ import java .util .Date ;
28+ import java .util .HashMap ;
29+ import java .util .Map ;
30+
3031/**
3132 * @author Emmanuel Bernard
3233 */
3334@ Entity
3435public class Atmosphere {
3536
36- public static enum Level {
37+ public enum Level {
3738 LOW ,
3839 HIGH
3940 }
@@ -43,45 +44,45 @@ public static enum Level {
4344 public Integer id ;
4445
4546 @ ManyToMany (cascade = CascadeType .ALL , fetch = FetchType .EAGER )
46- @ MapKeyColumn (name = "gas_name" )
47- public Map <String , Gas > gases = new HashMap <String , Gas >();
47+ @ MapKeyColumn (name = "gas_name" )
48+ public Map <String , Gas > gases = new HashMap <>();
4849
4950 @ MapKeyTemporal (TemporalType .DATE )
5051 @ ElementCollection (fetch = FetchType .EAGER )
51- @ MapKeyColumn (nullable = false )
52- public Map <Date , String > colorPerDate = new HashMap <Date , String >();
52+ @ MapKeyColumn (nullable = false )
53+ public Map <Date , String > colorPerDate = new HashMap <>();
5354
5455 @ ElementCollection (fetch = FetchType .EAGER )
5556 @ MapKeyEnumerated (EnumType .STRING )
56- @ MapKeyColumn (nullable = false )
57- public Map <Level , String > colorPerLevel = new HashMap <Level , String >();
57+ @ MapKeyColumn (nullable = false )
58+ public Map <Level , String > colorPerLevel = new HashMap <>();
5859
5960 @ ManyToMany (cascade = CascadeType .ALL , fetch = FetchType .EAGER )
60- @ MapKeyJoinColumn (name = "gas_id" )
61+ @ MapKeyJoinColumn (name = "gas_id" )
6162 @ JoinTable (name = "Gas_per_key" )
6263 public Map <GasKey , Gas > gasesPerKey = new HashMap <GasKey , Gas >();
6364
6465 @ ElementCollection (fetch = FetchType .EAGER )
65- @ Column (name = "composition_rate" )
66- @ MapKeyJoinColumns ( { @ MapKeyJoinColumn (name = "gas_id" ) } ) //use @MapKeyJoinColumns explicitly for tests
66+ @ Column (name = "composition_rate" )
67+ @ MapKeyJoinColumns ({ @ MapKeyJoinColumn (name = "gas_id" )} ) //use @MapKeyJoinColumns explicitly for tests
6768 @ JoinTable (name = "Composition" , joinColumns = @ JoinColumn (name = "atmosphere_id" ))
68- public Map <Gas , Double > composition = new HashMap <Gas , Double >();
69+ public Map <Gas , Double > composition = new HashMap <>();
6970
7071 //use default JPA 2 column name for map key
7172 @ ManyToMany (cascade = CascadeType .ALL , fetch = FetchType .EAGER )
7273 @ MapKeyColumn
73- @ JoinTable (name = "Atm_Gas_Def" )
74- public Map <String , Gas > gasesDef = new HashMap <String , Gas >();
74+ @ JoinTable (name = "Atm_Gas_Def" )
75+ public Map <String , Gas > gasesDef = new HashMap <>();
7576
7677 //use default HAN legacy column name for map key
7778 @ ManyToMany (cascade = CascadeType .ALL , fetch = FetchType .EAGER )
7879 @ MapKeyColumn
79- @ JoinTable (name = "Atm_Gas_DefLeg" )
80- public Map <String , Gas > gasesDefLeg = new HashMap <String , Gas >();
80+ @ JoinTable (name = "Atm_Gas_DefLeg" )
81+ public Map <String , Gas > gasesDefLeg = new HashMap <>();
8182
8283 @ ManyToMany (cascade = CascadeType .ALL , fetch = FetchType .EAGER )
8384 @ MapKeyJoinColumn
8485 @ JoinTable (name = "Gas_p_key_def" )
85- public Map <GasKey , Gas > gasesPerKeyDef = new HashMap <GasKey , Gas >();
86+ public Map <GasKey , Gas > gasesPerKeyDef = new HashMap <>();
8687
8788}
0 commit comments