Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for TAP5-2783 #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static void contributeValueEncoderSource(
for (EntityType<?> entityType : entities)
{
Class<?> entityClass = entityType.getJavaType();
if (entityClass != null)
if (entityClass != null && entityType.hasSingleIdAttribute())
{
SingularAttribute<?, ?> id = entityType.getId(entityType.getIdType().getJavaType());
final String idenfierPropertyName = id.getName();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.example.app0.entities;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;

/**
* This class is an example for an entity that uses a compound id. This triggers a bug with tapestry <= 5.8.6 during
* initialisation, see TAP-123.
*/
@IdClass(CompoundIdEntityPK.class)
@Entity
public class CompoundIdEntity {
@Id private Long firstId;
@Id private Long secondId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.example.app0.entities;

import java.io.Serializable;

public class CompoundIdEntityPK implements Serializable {
private Long firstId;
private Long secondId;

public CompoundIdEntityPK(Long firstId, Long secondId) {
this.firstId = firstId;
this.secondId = secondId;
}
}