Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自增主键ID问题 #68

Closed
jiangkaifang opened this issue Dec 15, 2023 · 2 comments
Closed

自增主键ID问题 #68

jiangkaifang opened this issue Dec 15, 2023 · 2 comments

Comments

@jiangkaifang
Copy link

您好!
我想问一下,如果我创建的表中包含自增键(比如说字段名叫 id),那么我对应表的实体类需要应该怎么来创建?如果实体类加入了 id 这个属性,那么在执行insert的时候就会出问题,如果实体类不加入 id 这个属性,那么我在select的时候应该怎么来取得这个 id 的值呢

@qiaoyuang
Copy link
Collaborator

你说的这个场景确实是个问题,目前你可以定义两个 data class,一个专门用来 insert,一个专门用来 select,用于暂时应对这个场景。至于长期的解决方案,我倾向于使用注解的方式,后续有进展我会同步给你。

@jiangkaifang
Copy link
Author

好的,谢谢你的回复,我已经知道该怎么做了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants