PERSISTENCE UNIT (PERSISTENCE.XML)

已回答

I want to create persistence.xml file like following picture, how to solve this problem in intellij?

0

Is this really what I'm looking for? I don't fully believe it. Basically, I want to convert my created entities directly to a table via jpa.

-1

You can't do it with IntelliJ IDEA, only the other way around.

0

Serge Baranov Then can you tell me how can I convert the entity I created to the table in the database via jpa?

-1

Really intellij didn't make most things possible. I don't understand why this makes things so difficult.

-1

You can't do it with IntelliJ IDEA.

0

Serge Baranov are you kidding me? This is a general rule, how can we not? So I can't convert my entity class that I created one into a database table?

-1

The feature you are looking for doesn't exist in IntelliJ IDEA. It can generate persistence mapping from the database schema, but not vice versa, see https://www.jetbrains.com/help/idea/persistence-tool-window.html#generate_entities_and_mappings .

0

Serge Baranov So is there any plugin for this that I can download?

0

We are not aware of such plug-ins.

0

There is such a plug-in. It's called JPA Buddy. The feature you're describing is only in the paid version of the plug-in. Here's how to use it:

  1. Install the JPA Buddy plug-in
  2. Open the "JPA Structure" window from View -> Tool Windows
  3. Click on the "+" in the top left of "JPA Structure"
  4. Click "Generate DDL by Entities"
  5. Select "DB schema initialization", then in "DB type" at the bottom of the window, select your type of SQL server
  6. This will create an "init-schema.sql" file which you can run on your database server to create the required tables
0

请先登录再写评论。