0
我在Grails/PostgreSql應用程序中擁有POJO域類,並且我試圖爲其ID標識postgres序列生成器。Grails POJO域類的序列生成器映射
在POJO:
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "flight_id")
public long getId() {
return id;
}
在Postgres裏:
-- Sequence: flight_id
-- DROP SEQUENCE flight_id;
CREATE SEQUENCE flight_id
INCREMENT 1
MINVALUE 1n
MAXVALUE 9223372036854775807
START 1
CACHE 1;
ALTER TABLE flight_id
OWNER TO postgres;
當我嘗試運行Grails的生成,所有該域的我得到:
Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.AnnotationException: Unknown Id.generator: flight_id
其他的一切似乎工作好吧,除了這個。我試圖使用Postres本地生成器,因此我可以選擇對獨立於Grails應用程序的數據庫運行CRUD操作。
任何提示將不勝感激。