Bartlomiej Niemiec (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5cdd0b2...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMWM0M2NiODky...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16987?atlOrigin=eyJpIjoiMWM0M2...
) HHH-16987 (
https://hibernate.atlassian.net/browse/HHH-16987?atlOrigin=eyJpIjoiMWM0M2...
) Error during JPA metamodel generation when entity defines static factory method (
https://hibernate.atlassian.net/browse/HHH-16987?atlOrigin=eyJpIjoiMWM0M2...
)
Issue Type: Bug Affects Versions: 6.3.0.CR1 Assignee: Unassigned Attachments: testcase.zip
Components: hibernate-jpamodelgen Created: 24/Jul/2023 23:32 PM Priority: Major Reporter:
Bartlomiej Niemiec (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5cdd0b2...
)
If I define the following entity:
@Entity
public class ExampleEntity {
@Id
private int id;
public static ExampleEntity of( int id) {
var obj = new ExampleEntity();
obj.setId(id);
return obj;
}
public int getId() {
return id;
}
public void setId( int id) {
this.id = id;
}
@Override public boolean equals( Object o) {
if ( this == o) {
return true ;
}
if (o == null || getClass() != o.getClass()) {
return false ;
}
ExampleEntity that = (ExampleEntity) o;
return id == that.id;
}
@Override public int hashCode() {
return Objects.hash(id);
}
}
then during metamodel generation i get error:
diagnostic: error: Error generating JPA metamodel: begin 0, end 3, length 2
This is caused by factory method *of* defined in entity. This example works in
6.2.7.Final
(
https://hibernate.atlassian.net/browse/HHH-16987#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16987#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100233- sha1:f5b6255 )