mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Merge pull request #3237 from ebean-orm/feature/3233
#3234 - Query Bean Generator Generates Non-Compilable Code When Entit…
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package org.example.domain.other;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Entity
|
||||
public class OtherSiteUser {
|
||||
|
||||
@Embeddable
|
||||
public static class Id {
|
||||
|
||||
// Use siteId, userId matching by db column naming convention
|
||||
public UUID siteId;
|
||||
public UUID userId;
|
||||
|
||||
public Id(UUID siteId, UUID userId) {
|
||||
this.siteId = siteId;
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Id that = (Id) o;
|
||||
return Objects.equals(siteId, that.siteId) && Objects.equals(userId, that.userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(siteId, userId);
|
||||
}
|
||||
}
|
||||
|
||||
@EmbeddedId
|
||||
Id id;
|
||||
|
||||
String description;
|
||||
|
||||
@Version
|
||||
long version;
|
||||
|
||||
}
|
||||
+10
-2
@@ -80,7 +80,7 @@ class ProcessingContext implements Constants {
|
||||
/**
|
||||
* For partial compile the previous list of prefixed entity classes.
|
||||
*/
|
||||
private List<String> loadedPrefixEntities = new ArrayList<>();
|
||||
private final List<String> loadedPrefixEntities = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* The package for the generated EntityClassRegister.
|
||||
@@ -360,7 +360,15 @@ class ProcessingContext implements Constants {
|
||||
* Create the QAssoc PropertyType.
|
||||
*/
|
||||
private PropertyType createPropertyTypeAssoc(String fullName) {
|
||||
String[] split = Split.split(fullName);
|
||||
TypeElement typeElement = elementUtils.getTypeElement(fullName);
|
||||
String type;
|
||||
if (typeElement.getNestingKind().isNested()) {
|
||||
type = typeElement.getEnclosingElement().toString() + "$" + typeElement.getSimpleName();
|
||||
} else {
|
||||
type = typeElement.getQualifiedName().toString();
|
||||
}
|
||||
|
||||
String[] split = Split.split(type);
|
||||
String propertyName = "Q" + split[1] + ".Assoc";
|
||||
String importName = split[0] + ".query.Q" + split[1];
|
||||
return new PropertyTypeAssoc(propertyName, importName);
|
||||
|
||||
Reference in New Issue
Block a user