Skip to content

Commit fe2230f

Browse files
committed
HHH-14276 Amend style and formatting
1 parent a8fdb4d commit fe2230f

File tree

5 files changed

+296
-313
lines changed

5 files changed

+296
-313
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,54 @@
1-
package org.hibernate.test.mapping.hhh14276;
2-
3-
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
4-
5-
import java.util.Map;
6-
7-
import org.hibernate.cfg.AvailableSettings;
8-
import org.hibernate.hql.spi.id.inline.InlineIdsOrClauseBulkIdStrategy;
9-
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
10-
import org.hibernate.test.mapping.hhh14276.entity.PlayerStat;
11-
import org.hibernate.test.mapping.hhh14276.entity.Score;
12-
import org.hibernate.testing.TestForIssue;
13-
import org.junit.Before;
14-
import org.junit.Test;
15-
16-
/**
17-
* This template demonstrates how to develop a test case for Hibernate ORM, using the Java Persistence API.
18-
*/
19-
@TestForIssue( jiraKey = "HHH-14276" )
20-
public class NestedIdClassDerivedIdentifiersTest extends BaseEntityManagerFunctionalTestCase
21-
{
22-
@Override
23-
protected Class<?>[] getAnnotatedClasses()
24-
{
25-
return new Class<?>[] { PlayerStat.class,
26-
Score.class };
27-
}
28-
29-
@Override
30-
protected void addConfigOptions( Map options )
31-
{
32-
options.put( AvailableSettings.GLOBALLY_QUOTED_IDENTIFIERS, Boolean.TRUE );
33-
options.put( AvailableSettings.HQL_BULK_ID_STRATEGY, InlineIdsOrClauseBulkIdStrategy.class.getName() );
34-
}
35-
36-
@Before
37-
public void setUp()
38-
{
39-
doInJPA( this::entityManagerFactory, em ->
40-
{
41-
// do nothing
42-
} );
43-
}
44-
45-
@Test
46-
public void testNestedIdClassDerivedIdentifiers() throws Exception
47-
{
48-
doInJPA( this::entityManagerFactory, em ->
49-
{
50-
// do nothing
51-
});
52-
}
53-
}
1+
/*
2+
* Hibernate, Relational Persistence for Idiomatic Java
3+
*
4+
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5+
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
6+
*/
7+
package org.hibernate.test.mapping.hhh14276;
8+
9+
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
10+
11+
import java.util.Map;
12+
13+
import org.hibernate.cfg.AvailableSettings;
14+
import org.hibernate.hql.spi.id.inline.InlineIdsOrClauseBulkIdStrategy;
15+
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
16+
17+
import org.hibernate.test.mapping.hhh14276.entity.PlayerStat;
18+
import org.hibernate.test.mapping.hhh14276.entity.Score;
19+
import org.hibernate.testing.TestForIssue;
20+
import org.junit.Before;
21+
import org.junit.Test;
22+
23+
@TestForIssue(jiraKey = "HHH-14276")
24+
public class NestedIdClassDerivedIdentifiersTest extends BaseEntityManagerFunctionalTestCase {
25+
@Override
26+
protected Class<?>[] getAnnotatedClasses() {
27+
return new Class<?>[] {
28+
PlayerStat.class,
29+
Score.class
30+
};
31+
}
32+
33+
@Override
34+
protected void addConfigOptions(Map options) {
35+
options.put( AvailableSettings.GLOBALLY_QUOTED_IDENTIFIERS, Boolean.TRUE );
36+
options.put( AvailableSettings.HQL_BULK_ID_STRATEGY, InlineIdsOrClauseBulkIdStrategy.class.getName() );
37+
}
38+
39+
@Before
40+
public void setUp() {
41+
doInJPA( this::entityManagerFactory, em ->
42+
{
43+
// do nothing
44+
} );
45+
}
46+
47+
@Test
48+
public void testNestedIdClassDerivedIdentifiers() {
49+
doInJPA( this::entityManagerFactory, em ->
50+
{
51+
// do nothing
52+
} );
53+
}
54+
}
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,82 @@
1-
package org.hibernate.test.mapping.hhh14276.entity;
2-
3-
import java.io.Serializable;
4-
5-
import javax.persistence.Basic;
6-
import javax.persistence.Column;
7-
import javax.persistence.Entity;
8-
import javax.persistence.FetchType;
9-
import javax.persistence.Id;
10-
import javax.persistence.IdClass;
11-
import javax.persistence.JoinColumn;
12-
import javax.persistence.ManyToOne;
13-
import javax.persistence.Table;
14-
15-
@Entity
16-
@Table(name = "\"PlayerStats\"")
17-
@IdClass(PlayerStatId.class)
18-
public class PlayerStat implements Serializable
19-
{
20-
private static final long serialVersionUID = 1L;
21-
22-
@Id
23-
@Column(name = "player_id")
24-
private Integer playerId;
25-
26-
@Basic(optional = false)
27-
@Column(name = "jersey_nbr")
28-
private Integer jerseyNbr;
29-
30-
@Id
31-
@ManyToOne(optional = false, fetch = FetchType.EAGER)
32-
@JoinColumn(name = "game_id", referencedColumnName = "game_id")
33-
@JoinColumn(name = "is_home", referencedColumnName = "is_home")
34-
private Score score;
35-
36-
public PlayerStat()
37-
{
38-
}
39-
40-
public Integer getGameId()
41-
{
42-
return score.getGameId();
43-
}
44-
45-
public void setGameId(Integer gameId)
46-
{
47-
score.setGameId(gameId);
48-
}
49-
50-
public Boolean getHome()
51-
{
52-
return score.getHome();
53-
}
54-
55-
public void setHome(Boolean home)
56-
{
57-
score.setHome(home);
58-
}
59-
60-
public Integer getPlayerId()
61-
{
62-
return playerId;
63-
}
64-
65-
public void setPlayerId(Integer playerId)
66-
{
67-
this.playerId = playerId;
68-
}
69-
70-
public Integer getJerseyNbr()
71-
{
72-
return jerseyNbr;
73-
}
74-
75-
public void setJerseyNbr(Integer jerseyNbr)
76-
{
77-
this.jerseyNbr = jerseyNbr;
78-
}
79-
80-
public Score getScore()
81-
{
82-
return score;
83-
}
84-
85-
public void setScore(Score score)
86-
{
87-
this.score = score;
88-
}
89-
}
1+
/*
2+
* Hibernate, Relational Persistence for Idiomatic Java
3+
*
4+
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5+
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
6+
*/
7+
package org.hibernate.test.mapping.hhh14276.entity;
8+
9+
import java.io.Serializable;
10+
11+
import javax.persistence.Basic;
12+
import javax.persistence.Column;
13+
import javax.persistence.Entity;
14+
import javax.persistence.FetchType;
15+
import javax.persistence.Id;
16+
import javax.persistence.IdClass;
17+
import javax.persistence.JoinColumn;
18+
import javax.persistence.ManyToOne;
19+
import javax.persistence.Table;
20+
21+
@Entity
22+
@Table(name = "\"PlayerStats\"")
23+
@IdClass(PlayerStatId.class)
24+
public class PlayerStat implements Serializable {
25+
26+
@Id
27+
@Column(name = "player_id")
28+
private Integer playerId;
29+
30+
@Basic(optional = false)
31+
@Column(name = "jersey_nbr")
32+
private Integer jerseyNbr;
33+
34+
@Id
35+
@ManyToOne(optional = false, fetch = FetchType.EAGER)
36+
@JoinColumn(name = "game_id", referencedColumnName = "game_id")
37+
@JoinColumn(name = "is_home", referencedColumnName = "is_home")
38+
private Score score;
39+
40+
public PlayerStat() {
41+
}
42+
43+
public Integer getGameId() {
44+
return score.getGameId();
45+
}
46+
47+
public void setGameId(Integer gameId) {
48+
score.setGameId( gameId );
49+
}
50+
51+
public Boolean getHome() {
52+
return score.getHome();
53+
}
54+
55+
public void setHome(Boolean home) {
56+
score.setHome( home );
57+
}
58+
59+
public Integer getPlayerId() {
60+
return playerId;
61+
}
62+
63+
public void setPlayerId(Integer playerId) {
64+
this.playerId = playerId;
65+
}
66+
67+
public Integer getJerseyNbr() {
68+
return jerseyNbr;
69+
}
70+
71+
public void setJerseyNbr(Integer jerseyNbr) {
72+
this.jerseyNbr = jerseyNbr;
73+
}
74+
75+
public Score getScore() {
76+
return score;
77+
}
78+
79+
public void setScore(Score score) {
80+
this.score = score;
81+
}
82+
}
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,52 @@
1-
package org.hibernate.test.mapping.hhh14276.entity;
2-
3-
import java.io.Serializable;
4-
5-
public class PlayerStatId implements Serializable
6-
{
7-
private static final long serialVersionUID = 1L;
8-
9-
private Integer playerId;
10-
11-
// nested composite PK @IdClass: named like relationship in entity class
12-
private ScoreId score;
13-
14-
public PlayerStatId()
15-
{
16-
}
17-
18-
public Integer getGameId()
19-
{
20-
return score.getGameId();
21-
}
22-
23-
public void setGameId(Integer gameId)
24-
{
25-
score.setGameId(gameId);
26-
}
27-
28-
public Boolean getHome()
29-
{
30-
return score.getHome();
31-
}
32-
33-
public void setHome(Boolean home)
34-
{
35-
score.setHome(home);
36-
}
37-
38-
public Integer getPlayerId()
39-
{
40-
return playerId;
41-
}
42-
43-
public void setPlayerId(Integer playerId)
44-
{
45-
this.playerId = playerId;
46-
}
47-
48-
public ScoreId getScoreId()
49-
{
50-
return score;
51-
}
52-
53-
public void setScoreId(ScoreId scoreId)
54-
{
55-
this.score = scoreId;
56-
}
57-
}
1+
/*
2+
* Hibernate, Relational Persistence for Idiomatic Java
3+
*
4+
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5+
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
6+
*/
7+
package org.hibernate.test.mapping.hhh14276.entity;
8+
9+
import java.io.Serializable;
10+
11+
public class PlayerStatId implements Serializable {
12+
13+
private Integer playerId;
14+
15+
// nested composite PK @IdClass: named like relationship in entity class
16+
private ScoreId score;
17+
18+
public PlayerStatId() {
19+
}
20+
21+
public Integer getGameId() {
22+
return score.getGameId();
23+
}
24+
25+
public void setGameId(Integer gameId) {
26+
score.setGameId( gameId );
27+
}
28+
29+
public Boolean getHome() {
30+
return score.getHome();
31+
}
32+
33+
public void setHome(Boolean home) {
34+
score.setHome( home );
35+
}
36+
37+
public Integer getPlayerId() {
38+
return playerId;
39+
}
40+
41+
public void setPlayerId(Integer playerId) {
42+
this.playerId = playerId;
43+
}
44+
45+
public ScoreId getScoreId() {
46+
return score;
47+
}
48+
49+
public void setScoreId(ScoreId scoreId) {
50+
this.score = scoreId;
51+
}
52+
}

0 commit comments

Comments
 (0)