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

Add more convenience methods to PersistenceConfiguration #621

Open
hantsy opened this issue Apr 28, 2024 · 1 comment
Open

Add more convenience methods to PersistenceConfiguration #621

hantsy opened this issue Apr 28, 2024 · 1 comment

Comments

@hantsy
Copy link
Contributor

hantsy commented Apr 28, 2024

I found there only provides a managedClass(Class<?> class) method in the PersistenceConfiguration, but does not provides methods to add a collection of classes.

eg.

PersistenceConfiguration managedClasses(Class<?> classes...)
PersistenceConfiguration managedClasses(Collection<Class<?>> classes)

// add all jpa managed classes in the package located by the specified class
PersistenceConfiguration managedPackage(Class<?> class)
PersistenceConfiguration managedPackages(Class<?> classes...) 
PersistenceConfiguration managedPackages(Collection<Class<?>> classes)
@gavinking
Copy link
Contributor

The way I usually do this is:

PersistenceConfiguration config = new PersistenceConfiguration();
...
List.of(Book.class, Author.class, Publisher.class).forEach(config::managedClass);

which seems .... fine, I guess.

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