2017-05-08 46 views
0

如何申請定製ID的汽車增量的Grails 3喜歡 -自動遞增Grails的3

STD_ID 
----------- 
REG-17-0001 
REG-17-0002 
REG-17-0003 
+0

前綴總是會是REG-17-? –

+0

'REG'是我的默認前綴,'17'是當年的最後兩位數字。 –

+0

看看http://stackoverflow.com/questions/4259746/whats-the-best-way-to-define-custom-id-generation-as-default-in-grails –

回答

0

您可以在mapping關閉自定義generator

static mapping = { 
    id generator: 'hilo'... 
} 

documentation1documentation2

+0

這是Hibernate內置的hilo生成器,它使用單獨的表來生成id。但我想在同一張表上生成ID列的STD_ID。 –