網頁

2012年8月30日 星期四

Primary keys must not contain null

執行native query時,出現Primary keys must not contain null
可是PK偏偏又出現在console中,EclipseLink看不懂
其實是因為column name大小寫不一致的問題,加上下面這行就搞定了

在persistence.xml的properties中加入:
<property name="eclipselink.jpa.uppercase-column-names" value="true"/>
順帶一提,sql如果只取出pk的話,一樣可以轉成entity,但是entity中只有pk會有值

沒有留言:

張貼留言