Generate feature classes from the database in game structure 2

I am new to playing the 2.0.3 framework trying to generate entity classes for database tables. I read the documentation for version 2.0, they mention Ebean for creating entity classes. I do not understand. And I also studied this tutorial. https://github.com/playframework/Play20/wiki/JavaEbean

Any help is appreciated.

thanks.

+4
source share
1 answer

As I understand it, you have an existing database structure, and you want to create models for them?

Unfortunately, this works in exactly the second direction: you need to create these classes, and then, if you enable automatic updating, Ebean will create a new DDL based on these classes as a new evolution, and then ask you to confirm the evolution when you refresh the next page.

Of course, you do not need to perform evolution if there are no changes to the database, and you need to add only the necessary classes.

Put them in the /app/models package, look at the document (you specified), and also the Java samples, how it behaves, that is: app/models/SomeModel.java will create some_model table (if you do not redefine it using the annotation )

And ... be careful, the Ebean plugin with automatically generated evolution destroys the entire database and restores it from scratch, so it is dangerous to use it in production, in which case you need to switch to manual spelling.

+2
source

Source: https://habr.com/ru/post/1437791/


All Articles