我對將靜態查找器添加到所有模型類感到惱火。來自父類的靜態查找器
爲什麼不能夠做到這一點:
@MappedSuperclass
public class MyModel<T> extends Model {
public static Finder<Integer,T> FIND = new Finder<Integer, T>(Integer.class,T.class);
}
@SuppressWarnings("serial")
@Entity
public class ValidationScript extends MyModel<ValidationScript> {
@Id
public Integer id;
@Column(length = 5000)
public String scriptCode;
}
不是一個解決方案,只是提示:現在大多數IDE允許創建一些動態的代碼模板,我在Idea中添加了一個,它可以在單鍵盤快捷鍵按下時創建適當的查找器。 – biesior 2013-03-09 08:50:28
我可以請你發佈你的想法的真人模特嗎? – cosmolev 2013-03-12 02:11:26