Hi,
we’re migrating from WildFly 20 to WildFly 30, which means Hibernate upgrade from 5.3.17.Final to 6.2.13.Final. Without any related changes we are now seeing an exception that we weren’t able to workaround so far, i.e. it worked using 5.3.17.Final but fails with 6.2.13.Final. Root cause (the bottom “Caused by”) of the original exception is “org.hibernate.query.SemanticException: Could not interpret path expression ‘Cactive’”, full stack trace in ex1.txt. The only change we’ve found so far that makes a slight difference is adding a table alias to the query (the a in FROM <CLASS> a where a.Cactive = True), which results in “org.hibernate.query.SemanticException: Could not resolve attribute ‘Cactive’ of ‘test.profile.ServiceDeliveryProfileCMP_PE’” as the root cause, full stack trace in ex2.txt.
Both the query and the entity are generated in runtime. Decompiled entity is attached as ServiceDeliveryProfileCMP_PE.java. ProfileEntity is an abstract class with no JPA annotations, profileName, tableName fields, a few boolean fields and corresponding accessors. JPAProfileId is an entity, attached for reference. 5.3.17.Final was run on Java 11, 6.2.13.Final runs on Java 21.
Neither the migration guide to v6, nor internet searches including this forum gave any ideas that would help work around this problem so far. Upgrading to latest stable version 6.5.2.Final did not help. Would appreciate any input on how to migrate to v6 or at least ideas for experiments that could bring us closer to a solution.
P.S. The “attachment” is available at elitnet.lt/download/hibernate_query_fail.tgz as only image and video files seem to be allowed as attachments.
Could you please attach the entity mappings as text in a comment on the forum? Though the error is pretty self-explanatory, apparently the entity-type which you alias as a in your query does not contain a mapped property named Cactive.
I suggest checking your mapping model and trying to figure out why that property name is not recognized anymore.
package test.profile;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;
import jakarta.persistence.Table;
import java.io.Serializable;
import javax.slee.ServiceID;
import org.mobicents.slee.container.deployment.profile.jpa.JPAProfileId;
import org.mobicents.slee.container.profile.entity.ProfileEntity;
@Entity
@IdClass(JPAProfileId.class)
@Table(name = "SLEE_PE_ServiceDeliveryProfileCMP_2097009070")
public class ServiceDeliveryProfileCMP_PE extends ProfileEntity implements ServiceDeliveryProfileCMP, Serializable {
private ServiceID serviceID;
private int priority;
private String calledNumber;
private boolean active;
private boolean defaultAction;
private String serviceKey;
private String vlrNumber;
private String callingNumber;
@Id
public String getProfileName() {
return super.getProfileName();
}
@Id
public String getTableName() {
return super.getTableName();
}
@Column(length = 512)
public ServiceID getCserviceID() {
return this.serviceID;
}
public void setCserviceID(ServiceID paramServiceID) {
this.serviceID = paramServiceID;
}
@Column
public int getCpriority() {
return this.priority;
}
public void setCpriority(int paramInt) {
this.priority = paramInt;
}
@Column
public String getCcalledNumber() {
return this.calledNumber;
}
public void setCcalledNumber(String paramString) {
this.calledNumber = paramString;
}
@Column
public boolean getCactive() {
return this.active;
}
public void setCactive(boolean paramBoolean) {
this.active = paramBoolean;
}
@Column
public boolean getCdefaultAction() {
return this.defaultAction;
}
public void setCdefaultAction(boolean paramBoolean) {
this.defaultAction = paramBoolean;
}
@Column
public String getCserviceKey() {
return this.serviceKey;
}
public void setCserviceKey(String paramString) {
this.serviceKey = paramString;
}
@Column
public String getCvlrNumber() {
return this.vlrNumber;
}
public void setCvlrNumber(String paramString) {
this.vlrNumber = paramString;
}
@Column
public String getCcallingNumber() {
return this.callingNumber;
}
public void setCcallingNumber(String paramString) {
this.callingNumber = paramString;
}
}
From my admittedly limited understanding of JPA, I don’t see why Cactive would no longer be recognized as a property of the entity. There must be some subtle change in v6 that I fail to recognize, possibly related to IdClass or base class of the entity.
I see no specific reason why this would stop working, but not that you entity class does not respect the Java Beans property accessor conventions, which are required by the JPA spec for @Entity classes: Jakarta Persistence.
Hibernate tries to support all kinds of mappings as a best-effort, but since yours go against specification I suppose, like you mentioned, something breaks along the way. You could try creating a reproducer using our test case templates and share it here, but even then I’m not sure I would call this a bug as it’s technically against specification.
That was indeed the problem. I did notice the odd naming inconsistency, but I was not aware of the JavaBeans naming convention requirement in JPA and did not think this could be the cause. Thanks a lot for the hint!
I’ve fixed the entity generation to follow the required naming convention, I don’t think it’s worth supporting non-compliant implementations.