我有一个拥有属性的实体,该属性是它自己的集合。如何编写我的类和OnModelCreating以正确创建数据库表?
class R {
public int cal(int a, int b) {
return a + b;
}
public int cal3(int a, int b) {
return a * b;
}
}
public class Rect {
public static void main(String arg[]) {
/*public static int cal2 ( int a, int b){
return a + b;
}
int ab2 = cal2(2,2);
System.out.println(ab2);*/
R r = new R();
int ab = r.cal(2, 2);
System.out.println(ab);
int ab3 =r.cal3(2,3);
System.out.println(ab3);
}
}
因此,对于最终结果,我希望我的数据库映射表(PriorCategories)看起来像这样:
Id - PK ParentCategoryId - FK到类别表 ChildCategoryId - FK到类别表
如何设置我的类和/或编程重写的OnModelCreating函数?
谢谢!
答案 0 :(得分:0)
您无需在OnModelCreating中执行任何操作 - 以下模型类将完美地建立与自身的关系:
.alert-header{
pointer-events: none;
}