forked from hibernate/hibernate-orm
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HHH-8879 HHH-8994 : Embeddable with associations used as a Map key
- Loading branch information
Showing
10 changed files
with
363 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
hibernate-core/src/test/java/org/hibernate/test/annotations/indexcoll/Currency.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//$Id$ | ||
package org.hibernate.test.annotations.indexcoll; | ||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.Id; | ||
|
||
|
||
@Entity | ||
public class Currency { | ||
private Integer id; | ||
|
||
|
||
@Id | ||
@GeneratedValue | ||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
|
||
@Column | ||
private String currency; | ||
|
||
|
||
public String getCurrency() { | ||
return currency; | ||
} | ||
|
||
public void setCurrency(String currency) { | ||
this.currency = currency; | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
hibernate-core/src/test/java/org/hibernate/test/annotations/indexcoll/ExchangeOffice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//$Id$ | ||
package org.hibernate.test.annotations.indexcoll; | ||
import java.math.BigDecimal; | ||
import java.util.Map; | ||
|
||
import javax.persistence.ElementCollection; | ||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.Id; | ||
|
||
import org.hibernate.annotations.CascadeType; | ||
|
||
|
||
@Entity | ||
public class ExchangeOffice { | ||
public ExchangeOffice() { | ||
super(); | ||
} | ||
|
||
@Id @GeneratedValue | ||
private Integer id; | ||
|
||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
@javax.persistence.OneToMany(mappedBy = "parent") | ||
@javax.persistence.MapKey(name="key") | ||
private Map<ExchangeRateKey, ExchangeRate> exchangeRates = new java.util.HashMap<ExchangeRateKey, ExchangeRate>(); | ||
|
||
public Map<ExchangeRateKey,ExchangeRate> getExchangeRates() { | ||
return exchangeRates; | ||
} | ||
|
||
@ElementCollection | ||
private Map<ExchangeRateKey, BigDecimal> exchangeRateFees = new java.util.HashMap<ExchangeRateKey, BigDecimal>(); | ||
|
||
public Map<ExchangeRateKey,BigDecimal> getExchangeRateFees() { | ||
return exchangeRateFees; | ||
} | ||
|
||
} |
63 changes: 63 additions & 0 deletions
63
hibernate-core/src/test/java/org/hibernate/test/annotations/indexcoll/ExchangeRate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
//$Id$ | ||
package org.hibernate.test.annotations.indexcoll; | ||
import javax.persistence.Column; | ||
import javax.persistence.Embedded; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.Id; | ||
|
||
|
||
@Entity | ||
public class ExchangeRate { | ||
public ExchangeRate() { | ||
super(); | ||
} | ||
|
||
@Id @GeneratedValue | ||
private Integer id; | ||
|
||
@Column | ||
private double rate; | ||
|
||
|
||
|
||
public double getRate() { | ||
return rate; | ||
} | ||
|
||
public void setRate(double rate) { | ||
this.rate = rate; | ||
} | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
@Embedded | ||
private ExchangeRateKey key = new ExchangeRateKey(); | ||
|
||
public ExchangeRateKey getKey() { | ||
return key; | ||
} | ||
|
||
public void setKey(ExchangeRateKey key) { | ||
this.key = key; | ||
} | ||
|
||
@javax.persistence.ManyToOne(fetch = FetchType.LAZY ) | ||
private ExchangeOffice parent = null; | ||
|
||
|
||
public ExchangeOffice getParent() { | ||
return parent; | ||
} | ||
|
||
public void setParent(ExchangeOffice parent) { | ||
this.parent = parent; | ||
} | ||
} |
Oops, something went wrong.