我试图在Grails 2.2.1中使用具有多对一关系的嵌入式域.这是我想要做的简化版本.
我正在映射到现有的db表:
create table incident (id bigint generated by default as identity, state_id bigint not null, primary key (id));
create table state (id bigint generated by default as identity, name varchar(255) not null, primary key (id));
alter table incident add constraint FK52F44D27499E79E foreign key (state_id) references state;
Run Code Online (Sandbox Code Playgroud)
映射到"事件"表的域:
class Incident {
Vehicle vehicle
static embedded = ['vehicle']
}
class Vehicle{
State state
static mapping = {
state column: 'state_id'
}
}
Run Code Online (Sandbox Code Playgroud)
映射到"状态"表的域:
class State {
String name
}
Run Code Online (Sandbox Code Playgroud)
当我尝试运行我的应用程序时,我收到以下错误: …
我没有问题使用git命令执行此操作,如将Git子模块设置为浅克隆和稀疏签出一样?但是我有一个使用Jenkins的项目,并且正在Groovy Pipeline语法中使用checkout()函数。我找不到任何将--depth选项传递给git子模块更新命令的选项。