1 2 Previous Next 15 Replies Latest reply on Feb 3, 2004 11:57 AM by jae77

    dvc-property

    jae77


      what is a dvc-property? i've seen it refered to in some of the entity beans and other objects associated w/ the bb code.

        • 1. Re: dvc-property

          A DVC property is a javabean that is a subset of fields of a CMP entity bean. For instance you can group several fields in that javabean and put a persistent field with that class type. Of course you must indicate to the CMP engine how to map this DVC (Dependant Valu Class) on the fields of the table.

          I introduced the usage of them in the forum (Auth for forum, Message for post)

          • 2. Re: dvc-property
            jae77

            ok - so that means changing a value on the DVC would cause the modified value to be written back out to the database by the entity bean?

            this is what's causing the bug of original messages getting quoted on replies - which i have a fix for, but haven't checked in yet.

            the only negative is that it won't fix all the posts that currently have this problem, but all new quoted posts will be fine.

            • 3. Re: dvc-property

              no, you have to do a set again and I am not sure you can keep the same object. i.e

              Auth auth = toto.getAuth();
              Auth newAuth = newAuth(auth);
              newAuth.setValue("aaa");
              toto.setAuth(newAuth);

              work, but without creating a new Auth object I am not sure it would. I have to ask Alex for that one and why.

              Could you expand on that bug ? yes I see lot of stupid quotes but I am wondering from where it comes. Do you have an idea ?

              • 4. Re: dvc-property

                again, please expand on this bug I am interested in having infos

                • 5. Re: dvc-property
                  jae77

                  here's what's happenning...

                  in the prepare method of the ReplyCommand, there is this code:

                  message = post.getMessage()
                  message.setText("\"" + post.getPoster().getAuthor(false) + "\" wrote:
                  " + message.getText() + "
                  ");
                  


                  when the setText method on message is called, it's actually altering the text of the original message as well. (it also changes the original subject to include "Re" as well).

                  in order to fix, i clone the retreived message.

                  message = (Message) post.getMessage().clone();
                  


                  the original message stays unaltered and the reply message is properly quoted.

                  i'm not fully understanding this behavior (is this normal when using a dvc?), but it seems that changing values on the Message object causes the entity bean to change as well - while acting on the cloned object does not.

                  let me know if you think this is a bug somewhere else, otherwise i will check in my fix.

                  • 6. Re: dvc-property

                    ok, did you fix it ? don't worry for the database, it is possible to fix it with a script and regex later. I am used that kind of stuff.

                    did you commit the fix ?

                    • 7. Re: dvc-property
                      jae77

                      no - i will commit the fix right now. i just wasn't sure if the bug could have had something w/ the dvc/entity object.

                      • 8. Re: dvc-property

                         

                        "cooper" wrote:
                        "cooper" wrote:
                        did you try the fix ? does it work ? could you explain how the DVC make the thing bug please ?


                        • 9. Re: dvc-property
                          jae77

                          ok - the fix is committed and you can close bug
                          #878547

                          • 10. Re: dvc-property
                            jae77

                             

                            "cooper" wrote:
                            did you try the fix ? does it work ? could you explain how the DVC make the thing bug please ?


                            my best guess is that the PostEJB has the original Message object, and
                            calling post.getMessage() is just returning the object reference.

                            so when you call message.setText(), you are really acting upon the original copy of the object, changing it's value, and causing it to be re-persisted w/ the updated text.

                            • 11. Re: dvc-property

                              I think you can close it by yourself and assign the bug to you

                              • 12. Re: dvc-property

                                 

                                "cooper" wrote:
                                I have to make some standalone test on that. The doco we have does not say anything about it, maybe I was too foolish to use them.


                                • 13. Re: dvc-property
                                  jae77

                                  nope :)

                                  b/c it's already been assigned to you, i can't make any modifications. i can only take unassigned bugs and make modifications to it's status, etc.

                                  • 14. Re: dvc-property
                                    jae77

                                     

                                    "cooper" wrote:
                                    I have to make some standalone test on that. The doco we have does not say anything about it, maybe I was too foolish to use them.


                                    i think the dvc's are a cool idea. it saves you from having to do the "manual" work of having to create that value object.

                                    this may be a potential drawback to using them, but it's easily solved w/ some documentation.

                                    1 2 Previous Next