Comments (1)
We have good news and bad news. The bad news, is that we didn't go into sufficient detail on this in the docs and that's why you couldn't find it! 👎
The good news: we do support this! 👍 If you look in the lifecycle events section of the docs, you'll notice that we briefly touch upon @OnCommit
and @OnUpdate
annotations. We actually support this for all operations, in fact. That is, there is an equivalent @OnCreate
and @OnDelete
. We do not support an @OnRead
since you already have control of the getter method for that :)
Likewise, where supported you can use standard JPA callbacks. The reason we built these additional annotations to augment these is that Elide annotations can monitor on a per-column basis.
I will look into updating the docs today to make this clearer. Thank you for calling this out!
In regards to your example
I would expect an implementation for this would look similar to the following:
// ... annotations
@Entity
public class User {
// ... user fields
// Assuming this isn't a persisted field:
private boolean isCreated = false;
@OnCreate
public void onCreateUser() {
// This is executed upon object creation before commit.
isCreated = true;
}
@OnCommit
public void onCommitUser() {
if (isCreated) {
// send email
}
}
}
Please verify that this addresses your question and we can close the issue!
from elide.
Related Issues (20)
- Generated OAS incorrectly sets objects as nodes
- elide-spring-boot-starter:7.0.0-pr5 doesn't work with spring boot 3.1.1 HOT 5
- CVE-2023-34620 - HJson vulnerability. HOT 2
- Attempting to deploy standalone Elide WAR app results in "java.lang.IllegalStateException: No Jetty ContextHandler, Jakarta WebSocket SCI unavailable" HOT 2
- Is two-phase binding mandatory? HOT 3
- Elide 7.x Release schedule HOT 8
- Aggregation data store with json fields
- Hibernate L2 cache
- 7.0.0-pr6 error: Unknown collection HOT 1
- Cannot use Map with 7.0.0-pr6 HOT 2
- JsonApi.patch NullPointerException when missing headers
- RSQL =ini= cannot handle kotlin enums HOT 1
- Lifecycle hook ordering is not deterministic in v7 HOT 3
- Does Elide GraphQL support cascading delete? HOT 3
- Can every entity be root entity? HOT 2
- Entity scan on non-existing data model package silences error
- Mismatch between documentation and implementation of default page size
- Cannot sort across a to-many relationship
- @LifeCycleHookBinding doesn't work with ENUM HOT 3
- Inverse relationship hooks not triggering for polymorphic types HOT 1
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 elide.