Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does Ebean achieve validation and update strategies similar to those in JPA? #3544

Open
whiteS18 opened this issue Jan 22, 2025 · 3 comments

Comments

@whiteS18
Copy link

No description provided.

@rPraml
Copy link
Contributor

rPraml commented Jan 22, 2025

Can you give us more details and use case please?

Most of the validation is done by the underlying database. You will get a persistence-exception when you try to insert null in a non null column or a too long value in a varchar column.

There is a special validation for (unbounded) clobs: #3343

If you want to do bean validation, you might take a look at hibernate bean validator

@whiteS18
Copy link
Author

@rPraml Hello, what I mean is that in JPA, you can configure the DDL strategy as update/create/dropCreate to decide whether to update the table structure, create tables, or drop and recreate tables when the project starts. I would like to know how to achieve this in Ebean. Currently, I only see that tables can be created by configuring whether to execute DDL.

@rPraml
Copy link
Contributor

rPraml commented Jan 24, 2025

Ebean ddl-generator and runner is mainly for testing.
There is also https://ebean.io/docs/db-migrations/

Note: These scripts are generated "offline" from your code base. Ebean does NOT "look into the database" and tries to migrate it. So if you have manually altered a table or added an index, you might get problems later, because ebean does not know about this.

You can control the generation with @DbMigration annotations or add also custom scripts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants