Skip to content

Commit

Permalink
Avoid isPersisted being saved in elasticsearch index (#27704)
Browse files Browse the repository at this point in the history
Fix #27686
  • Loading branch information
OmarHawk authored Oct 28, 2024
1 parent cda0f24 commit 0ef8d1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
<%_ } _%>
<%_ if (databaseTypeSql && reactive) { _%>
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
<%_ if (requiresPersistableImplementation) { _%>
Expand Down Expand Up @@ -395,7 +394,7 @@ public class <%= user.persistClass %><% if (generateSpringAuditor) { %> extends
@BatchSize(size = 20)
<%_ } _%>
<%_ if (databaseTypeSql && reactive) { _%>
@Transient
@org.springframework.data.annotation.Transient
<%_ } _%>
<%_ if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j) { _%>
private Set<Authority> authorities = new HashSet<>();
Expand All @@ -413,7 +412,7 @@ public class <%= user.persistClass %><% if (generateSpringAuditor) { %> extends
<%_ } _%>
<%_ if (databaseTypeSql && reactive && requiresPersistableImplementation) { _%>
@Transient
@org.springframework.data.annotation.Transient
private boolean isPersisted;
<%_ } _%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
<&_ } -&>

<&_ if (fragment.classAdditionalFieldsSection) { -&>
@org.springframework.data.annotation.Transient
<%_ if (!reactive) { _%>
@Transient
<%_ } _%>
private boolean isPersisted;
<&_ } -&>

Expand All @@ -48,7 +51,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
}
<%_ } -%>

@org.springframework.data.annotation.Transient
<%_ if (!reactive) { _%>
@Transient
<%_ } _%>
@Override
public boolean isNew() {
return !this.isPersisted;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
-%>
<&_ if (fragment.importSection) { -&>
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
<&_ } -&>
Expand Down Expand Up @@ -55,7 +54,7 @@ import org.springframework.data.relational.core.mapping.Table;

<%_ for (const relationship of relationships) { _%>
<&_ if (fragment.relationship<%- relationship.relationshipNameCapitalized %>AnnotationSection) { -&>
@Transient
@org.springframework.data.annotation.Transient
<&_ } -&>
<%_ } -%>

Expand Down

0 comments on commit 0ef8d1c

Please sign in to comment.