-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Make REST Data Panache work properly with id fields not named 'id'
- Loading branch information
Showing
3 changed files
with
94 additions
and
18 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
30 changes: 29 additions & 1 deletion
30
...test/java/io/quarkus/hibernate/orm/rest/data/panache/deployment/entity/EmptyListItem.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 |
---|---|---|
@@ -1,8 +1,36 @@ | ||
package io.quarkus.hibernate.orm.rest.data.panache.deployment.entity; | ||
|
||
import javax.json.bind.annotation.JsonbTransient; | ||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.Id; | ||
import javax.persistence.ManyToOne; | ||
|
||
import io.quarkus.hibernate.orm.panache.PanacheEntityBase; | ||
|
||
@Entity | ||
public class EmptyListItem extends AbstractItem<Long> { | ||
public class EmptyListItem extends PanacheEntityBase { | ||
|
||
@Id | ||
@GeneratedValue | ||
private Long cid; | ||
|
||
public String name; | ||
|
||
@ManyToOne(optional = false) | ||
public Collection collection; | ||
|
||
public Long getCid() { | ||
return cid; | ||
} | ||
|
||
public void setCid(Long cid) { | ||
this.cid = cid; | ||
} | ||
|
||
@JsonbTransient // Avoid infinite loop when serializing | ||
public Collection getCollection() { | ||
return collection; | ||
} | ||
|
||
} |
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