I have a table whose primary key is a varchar.
When I modify this field, the field change, but dbforms goes to the first register of this table, instead of the same register with the new values. If a change other fields (not primary keys) I do not have this problem.
I am using dbforms 2.3.
Which is the problem? Is a bug or a feature? Are there any workarround?
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think the problem is in
org.dbforms.servlets.Controller.java
method:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
At the end, in this code:
if (!Util.isNull(followUp)) {
request.getRequestDispatcher(followUp)
.forward(request, response);
}
When you update the primary key, you have the old and the news values in the request object. You also have in this object the firstpos and lastPos parameter which represents the first and last position in the table you want to show (Am I right?). In this case, both parameters have the same values, which is the primary key of the register. If we change the value of the primary key, we need to change the first position and last position of the request of the followUp, but we use the same request that we have received as a parameter in process method.
Do you agree with me?
How can we change it?
I suppose we have to use a different request object for the followUp.
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In many tables I don't use independent primary keys, because in those cases I use autoinc keys and I have problems with them in dbforms. Now, I know how to solve these problems, but it is too late to change it. I can't spend more hours in the project. Perhaps next time, next project.
Thank you very much.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a table whose primary key is a varchar.
When I modify this field, the field change, but dbforms goes to the first register of this table, instead of the same register with the new values. If a change other fields (not primary keys) I do not have this problem.
I am using dbforms 2.3.
Which is the problem? Is a bug or a feature? Are there any workarround?
Thanks.
Seems to be a bug - could you try to find it?
Henner
I think the problem is in
org.dbforms.servlets.Controller.java
method:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
At the end, in this code:
if (!Util.isNull(followUp)) {
request.getRequestDispatcher(followUp)
.forward(request, response);
}
When you update the primary key, you have the old and the news values in the request object. You also have in this object the firstpos and lastPos parameter which represents the first and last position in the table you want to show (Am I right?). In this case, both parameters have the same values, which is the primary key of the register. If we change the value of the primary key, we need to change the first position and last position of the request of the followUp, but we use the same request that we have received as a parameter in process method.
Do you agree with me?
How can we change it?
I suppose we have to use a different request object for the followUp.
Thanks.
I agree with you. But we can't change first and lastpos during update - there is not only the primary key in this fields.
Is it really necessary to change the primary key? I think you can get problems inside your database if you allow to change the primary key.
In my application i have an indepentend primary key which can not be changed by users and a unique index for fields that should be unique.
Cheers,
Henner
In many tables I don't use independent primary keys, because in those cases I use autoinc keys and I have problems with them in dbforms. Now, I know how to solve these problems, but it is too late to change it. I can't spend more hours in the project. Perhaps next time, next project.
Thank you very much.