本文介绍了在jpa / EclipseLink创建表后执行sql脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在EclipseLink生成ddl之后执行sql脚本?

换句话说,是否有可能EclipseLink属性eclipselink.ddl-generation具有drop-and-在创建表定义之后,使用了create-tables并且EclipseLink执行另一个sql文件(将一些数据插入到刚创建的某些表中)?

is there a possibility to execute an sql script, after EclipseLink generated the ddl?
In other words, is it possible that the EclipseLink property "eclipselink.ddl-generation" with "drop-and-create-tables" is used and EclipseLink executes another sql-file (to insert some data into some tables just created) after creating the table definition?

我正在使用带有GlassFish v3的EclipseLink 2.x和JPA 2.0。

I'm using EclipseLink 2.x and JPA 2.0 with GlassFish v3.

或者我可以在项目调用的java方法(与ejb3的战争)部署中初始化表吗?

Or can I init the tables within a java method which is called on the project (war with ejb3) deployment?

推荐答案

它被称为BEFORE ddl-execution。并且似乎没有很好的方法来适应它,因为没有合适的事件可以使用。

It is called BEFORE ddl-execution. And there seems to be no nice way to adapt it, as there is no suitable event one could use.

这篇关于在jpa / EclipseLink创建表后执行sql脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 12:20