powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Java [игнор отключен] [закрыт для гостей] / Maven 2 & Hibernate 3
5 сообщений из 5, страница 1 из 1
Maven 2 & Hibernate 3
    #33792959
BlackWall
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Подскажите плиз лучший способ выполнения таких задач, как генерация схемы БД с помощью SchemaExport.
Видимые решения -
1. встраивание тегов Ant для вызова SchemaExportTask. Коряво как-то.
2. использовать старый плагин maven-hibernate-plugin, который почему-то вызывает NullPointerException в org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginManager.java:292). Похоже, плагин и не думают привязывать к Hibernate 3, и все равно не работает.
3. запускать класс SchemaExport через java, и пока не нашел как это вообще делать.

Так что, надеюсь на помощь.
...
Рейтинг: 0 / 0
Maven 2 & Hibernate 3
    #33793262
Jozic
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
BlackWall...
3. запускать класс SchemaExport через java, и пока не нашел как это вообще делать.
... Hibenate in Action
Код: plaintext
1.
2.
3.
Configuration cfg =  new  Configuration();
SchemaExport schemaExport =  new  SchemaExport(cfg);
schemaExport.create(false, true);
A new SchemaExport object is created from a Configuration. If you use a hibernate.
cfg.xml, the database connection settings and the dialect will be available in
the Configuration and passed to the SchemaExport constructor. The create(
false, true) call triggers the DDL creation process without any SQL printed
to stdout (false) but with DDL immediately executed in the database (true). See the
SchemaExport API for more information; all command-line options are also available
directly in Java and can be set on the SchemaExport object.
...
Рейтинг: 0 / 0
Maven 2 & Hibernate 3
    #33793558
BlackWall
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Мы ведь говорим о сборке теми инструментами, что есть, а не о том, как эти инструменты сделать самому. Ясное дело, что из кода я могу вызвать SchemaExport.
...
Рейтинг: 0 / 0
Maven 2 & Hibernate 3
    #33794127
marx_freedom
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
я первым способом пользуюсь (теги ant), может и коряво, но работает.
--
Солнце встанет непременно!
jabber id: marx [.at.] jabber [.dot.] ru
...
Рейтинг: 0 / 0
Maven 2 & Hibernate 3
    #33799062
BlackWall
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Вот как я сделал запуском SchemaExport
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version> 1 . 0 </version>
                <executions>
                    <execution>
                        <id>schemaexport</id>
                        <phase>test</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>org.hibernate.tool.hbm2ddl.SchemaExport</mainClass>
                    <arguments>
                        <argument>--quiet</argument>
                        <argument>--text</argument>
                        <argument>--delimiter=;</argument>
                        <argument>--output=${basedir}/target/classes/sql/oracle/schema.sql</argument>
                        <argument>--config=/hibernate.cfg.xml</argument>
                        <argument>--properties=${basedir}/src/main/resources/sql/oracle/hibernate.properties</argument>
                    </arguments>
                    <systemProperties>
                        <systemProperty>
                            <key>foo</key>
                            <value>bar</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
            </plugin>

Вот только требуется наличие тупого systemProperty, иначе NullPointerException. Хотелось бы , конечно, увидеть работающий плагин для Hibernate.
...
Рейтинг: 0 / 0
5 сообщений из 5, страница 1 из 1
Форумы / Java [игнор отключен] [закрыт для гостей] / Maven 2 & Hibernate 3
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]