JavaRush /Java блог /Архив info.javarush /Почему Intellij IDEA не дает возможность создавать маппин...
Nullptr
35 уровень
Москва

Почему Intellij IDEA не дает возможность создавать маппинг на основе наших POJO?

Статья из группы Архив info.javarush
можно создать mapping только by Database schema Здравствуйте! Хочу создать маппинг своего класса(POJO), но idea дает на выбор только by Database schema, хотя должно быть еще entity bean. (Ps в eclipse есть hibernate tools, который легко позволяет создавать mapping xml files, почему в идее такого нет?) Как это исправить? Буду рад вашим советам и комментариям. Спасибо.
Комментарии (5)
ЧТОБЫ ПОСМОТРЕТЬ ВСЕ КОММЕНТАРИИ ИЛИ ОСТАВИТЬ КОММЕНТАРИЙ,
ПЕРЕЙДИТЕ В ПОЛНУЮ ВЕРСИЮ
Dimont Уровень 22
29 марта 2017
Смотри, что советуют на stackoverflow:

The steps are simple but I guess its difficult since you are used to the eclipse interface (I would feel the same way if I had to do it in Eclipse)

First you need tell intelliJ that you are using Hibernate (I guess you are if you need the orm pojo of the table)

Go to «Project structure» (alt+ctrl+shift+s)
In «Project settings» select «Modules»
Press + and add the Hibernate facet in your module.
Now you have setup your hibernate configuration facet you can extract your pojos.

At your bottom right horizontal panel you will now see a tab called «Persistence» (ιf you can't find Persistence tab you may show it by choosing View > Tool Windows > Persistence)
There you can right click on the hibernate icon named like your module
Go to «Generate Persistence Mapping»-«by database schema»
Now I guess you can find your way…
In general settings select the datasource that you want to use and now you can see all the tables in your datasource object
Now you can do many things, add relationships with the + sign, change the name and type of the pojo's properties etc. note: if you get an error and the «OK» is disabled its probably because the data type that intelliJ found for your pojo is invalid. Just change it to the one you need and you are ready to go!
UPDATE:
In IntelliJ 16 this feature in now implemented. The steps to do it are:
Database view context menu
Scripted Extensions
Generate POJOs
youtrack.jetbrains.com/oauth?state=%2Fissue%2FIDEA-66037
ferasinka Уровень 32
27 марта 2017
Может плагин какой отключен?
Nullptr Уровень 35
26 марта 2017
up!