Comments (5)
from micronaut-data.
Have you tried to have @GeneratedValue
?
from micronaut-data.
It works with @AutoPopulated
and @GeneratedValue
if record initializer is removed. That is confusing app from creating new record with generated id, it seems. Changing record to this
@Serdeable
@MappedEntity
public record Pet(
// This class uses an autopopulated UUID for the primary key
@Id @AutoPopulated @Nullable UUID id,
String name,
// A relation is defined between Pet and Owner
@Relation(Relation.Kind.MANY_TO_ONE)
Owner owner,
// Optional columns can be defined by specifying Nullable
@Nullable
PetType type) {
// Secondary record constructors make it easier to construct instances
public Pet(String name, Owner owner) {
this(name, owner, null);
}
public Pet(String name, Owner owner, PetType type) {
this(null, name, owner, type == null ? PetType.DOG : type);
}
public enum PetType {
DOG,
CAT
}
}
seems to be working.
from micronaut-data.
note this is a regression as it used to work
from micronaut-data.
Yes, in 3.10.0 it worked. This is the difference when record is used. This method in DefaultEntityEventContext
@Override
public <P> void setProperty(BeanProperty<T, P> property, P newValue) {
if (property.hasSetterOrConstructorArgument()) { // in 3.10.0 this returns true and in 4.4.2 false
if (property.isReadOnly()) {
this.entity = property.withValue(entity, newValue);
} else {
property.set(entity, newValue);
}
}
}
from micronaut-data.
Related Issues (20)
- docs: How optimistic locking interacts with @Transactional should be documented HOT 5
- Support multiple @JdbcRepository annotations with different dialect and activate appropriate one based on criteria HOT 3
- Incorrect number of parameters expected when using IN Query with property injection HOT 4
- Action Required: Fix Renovate Configuration HOT 1
- Java 22 issue: Cannot query entity [XXX] on non-existent property: Id HOT 5
- Complete Support for JPA Criteria API HOT 3
- Provider org.hibernate.bytecode.internal.bytebuddy.BytecodeProviderImpl could not be instantiated GraalVm HOT 5
- Add Jakarta Data Support HOT 2
- Misleading example code in Documentation about Joins (Section 4.4) HOT 1
- Latest changes on DefaultPage behaviour breaks io.micronaut.data.model.Page.map
- Wrong entity mapping for multiple ONE_TO_MANY relations of the same entity HOT 3
- `alias` attribute from `@MappedEntity` is not working HOT 2
- AsyncTransactionOperations<Connection> hangs when commit throws exception
- Can't inject a Repository bean extending RxJavaCrudRepository
- Cannot persist Entity with several inverse one-to-many relations due to UnsupportedOperationException HOT 2
- Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] due to: Cannot invoke "String.length()" because "path" is null HOT 3
- Docs: Javadocs for CrudRepository don't explain what exceptions are thrown
- Issue with JPA Criteria API when dealing with hierarchical relationships HOT 1
- Tests break when disabling datasources HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micronaut-data.