Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要persist()一个带有 的对象id,我可以指定它。但是我不能用不同的注释基类@GeneratedValue. 您可以为单个持久性分配一个值生成器吗?我有特定用途,请不要告诉我不应该手动设置id。
persist()
id
@GeneratedValue
有没有办法用 JPA 来完成?感谢任何提示!
[已编辑]@GeneratedValue注释存在于基类中
@GeneratedValue精确地用于告诉 JPA 它应该生成 ID。如果您想显式分配 ID 并且不希望 JPA 为您生成一个,只需不要使用@GeneratedValue注释,显式分配 ID,然后调用persist().
所以我使用下面的代码让我的应用程序在不同的 android 设备上缩放屏幕尺寸,但是当我在我的 Nexus 7 上进行测试时,它不会缩放,就好像它在 4 英寸屏幕上一样。当我在 7 英寸屏幕上的模拟器中运行它时,它可以工作。我的清单文件有什么问题吗?
<supports-screens android:resizeable="true"