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

关于uuid #114

Closed
csg0328 opened this issue Nov 15, 2011 · 6 comments
Closed

关于uuid #114

csg0328 opened this issue Nov 15, 2011 · 6 comments

Comments

@csg0328
Copy link

csg0328 commented Nov 15, 2011

实际开发中,可能很多人会用到uuid,nutz貌似没有提供这方面的东东,建议是不是可以加个uuid生成什么的

实现也很简单
java.util.UUID.randomUUID().toString().replace("-", "");

@wendal
Copy link
Member

wendal commented Nov 15, 2011

加一个到Lang类?

@csg0328
Copy link
Author

csg0328 commented Nov 16, 2011

@id(auto=false)可不可以在这里搞个GeneratorType,可以参考下JPA ID生成策略

@wendal
Copy link
Member

wendal commented Nov 16, 2011

考虑扩展使用
@JsonField(by="")的生成器机制

@csg0328
Copy link
Author

csg0328 commented Nov 16, 2011

噢,这样啊,期待中

@ghost
Copy link

ghost commented Nov 23, 2011

现在nutz支持这种EL标注
@name
@column("id")
@Prev(els = @el("$me.initUUID()"))
protected String id;

public String initUUID() {
    if (this.id == null)
        return UUID.randomUUID().toString();
    return this.id;
}

我觉得可以满足上面提到的主键生成策略问题

@zozoh
Copy link
Member

zozoh commented Dec 7, 2011

哦,就是那个 @el 就是设计给生成 UUID 用的
那我关了这个 Issue 了哦

@zozoh zozoh closed this as completed Dec 7, 2011
@zozoh zozoh mentioned this issue Dec 7, 2011
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

3 participants