n 层系统中数据模型之间的映射!
问候溢出者,
我真的对这个主题进行了过度思考
,以下是典型的映射:
关系数据库模型<>服务器面向对象模型<>系列化型号>>客户端面向对象模型
<>代表双向映射
我目前使用 Java 作为后端,使用 ExtJS(JavaScript 库)作为前端。 与 Java 和 JSON 对象进行序列化是有意义的。您推荐的 JSON 序列化库是什么?为什么 ?
您对数据库方面的建议怎么样?我真的很讨厌关系面向对象映射的开销和复杂性。我喜欢 objectdb 对干净的 JPA2 的支持,但它很昂贵。遗憾的是,它似乎是唯一原生支持 JPA2 的 OO 数据库。您对此有何看法,特别是在 API 清洁度和性能方面?
如何使用关系数据库管理数据存储?例如,您是否使用包装类来包装数据集?或者直接操作数据集而不映射到对象?例如,您是否直接从这些数据集映射到 JSON?
在发送之前对序列化数据进行压缩/加密?以及如何使用 JavaScript 将其反转?
我真的在寻找一个干净、快速的 API 堆栈来完成我的工作,
提前谢谢您!
Greetings Overflowers,
I'm really tiered of over-thinking this subject
Here are typical mappings:
Relation DB Model <> Server OO Model <> Serialized Model <> Client OO Model
<> stands for bi-directional mapping
I'm currently using Java for my backend and ExtJS (JavaScript library) for my frontend.
It makes sense to serialize to/from Java and JSON objects. What is your recommended JSON serialization library ? why ?
How about your recommendation on the DB side ? I really hate the overhead and complexity of relational-OO mapping. I love objectdb's support for the clean JPA2, but it is expensive. Sadly, it seems to be the only OO db to support JPA2 natively. What are your thoughts on this especially when it comes to API cleanness and performance ?
How do you manage your data stores using relational DBs ? do you, for e.g., use wrapper classes to wrap datasets ? or directly manipulate datasets without mapping to objects ? do you map directly to JSON, for e.g., from those datasets ?
Anything for compression/encryption of serialized data before sending ? and how to reverse it back using JavaScript ?
Im really looking for a clean and fast stack of APIs to do my job
Thank you in advance !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否致力于在服务器上使用 Java?如果没有,带有 MongoDb 数据库的 Node.js 可能会消除链中的几个环节,因为 Mongo 允许您存储 JSON 文档,并且您的服务器应用程序是用 Javascript 编写的。因此,据报道,所有一种语言、所有一种数据表示以及 Node.js+mongo 都提供了惊人的性能和可扩展性。您还可以消除 SQL,直接将数据库数据作为 Javascript 对象处理。您也不定义数据库架构 - 您存储 JSON 文档。
正是出于这些原因,我个人将所有个人服务器端开发转移到了 Node.js 和 mongo。更简单,可能更快,并且更容易扩展。
您还可以在整个堆栈中使用相同的语言,并且 Javascript 的重构能力比 Java 更具表现力。
Are you committed to using Java on the server? If not, node.js with a MongoDb database might eliminate a couple links in the chain, because Mongo lets you store JSON documents and your server app is written in Javascript. so all one language, all one data representation, and node.js+mongo provides reportedly amazing performance and scalability. You also eliminate SQL, dealing with the db data directly as Javascript objects. You also don't define a db schema - you store JSON documents.
I'm personally moving all my personal server-side development to node.js and mongo for precisely these reasons. Much simpler, probably faster, and more easily scalable.
You also get to use the same language throughout the stack, and Javascript is a more expressive language than Java in its refactoring power.