I am making kind of CRUD application (Java GUI , MYSQL) Should I :
- load data from database to List (for example) and then List to GUI
- load data from database to Object(with attributes like SQL table) and Object to GUI
我只是瘫痪,还是真的需要另一个目标?
I am making kind of CRUD application (Java GUI , MYSQL) Should I :
我只是瘫痪,还是真的需要另一个目标?
理想情况下,为了严格分离关注点,您会希望保持两个模型的分离。
如果您正在开发MVC(即Model,View,Controller)丰富的客户端应用程序,则应使用单独的模型绑定到GUI /表单,这称为视图模型,其目的是呈现,捕获和验证来自GUI的数据。理想情况下,您将把这些数据复制到域或数据模型中,这是您要持久化的模型。
这真的取决于应用程序是否要走那么远,对于那些只用于完成简单任务的1-2屏幕即可扔掉的应用程序,我真的不太在意,但是这种方法在开发大型复杂应用程序时确实非常有帮助。
理论上,您可以两者都做,但选择第二种方法将使稍后添加一些非基本功能(例如验证)更加容易。
我猜它很大程度上取决于你要用数据做什么以及有多少数据。
例如,如果您只打算在某种表格结构的 GUI 上展示它,您可能不需要对象。但是,如果您想以非表格化的方式呈现数据,或者想要修改数据,或者数据也有行为附加,那么对象是更好的选择。但是,如果您需要处理表格中的 300 万行,您就不想用对象占用内存了...
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...