-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: using only get methods in persistent classes ?
PostPosted: Tue Dec 02, 2003 1:28 pm 
Newbie

Joined: Tue Dec 02, 2003 1:08 pm
Posts: 5
Hi,

I'm working on an application in which my persistent classes are created by parsing through a text file, extracting necessary information and populating the classes through a constructor. These properties can only be set once and they can never be modified. For this reason, the classes only have get methods to access the variables. This was giving me the exception

net.sf.hibernate.PropertyNotFoundException: Could not find a setter for property .... in class ....

I think I read somewhere that this issue was resolved in version 2.1rc1 which I have now downloaded to use, but I cannot find any documentation on how to do so. Could someone please point me in the correct direction or let me know if it is even possible to do so using Hibernate?

Thanks,
Priya


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 02, 2003 2:50 pm 
Regular
Regular

Joined: Fri Sep 05, 2003 12:01 am
Posts: 80
Location: Bogot
Use the update attribute in the property tag and create your setter method.

i.e

Code:
<hibernate-mapping>
    <class
        name="com.cce.domain.Chapter"
        table="projectchapter"
        dynamic-update="false"
        dynamic-insert="true"
    >

        <id
            name="id"
            column="id"
            type="long"
            unsaved-value="0"
        >
            <generator class="native">
            </generator>
        </id>

        <property
            name="unmutable_property"
            type="java.lang.String"
            [b]update="false"[/b]
            insert="true"
            column="unmutalble_column"
            not-null="true"
        />
</class>


Hope it helps.

_________________
Mauricio Hern


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 02, 2003 3:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You can also use the access=field atribute of the property mapping


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2003 1:26 pm 
Newbie

Joined: Tue Dec 02, 2003 1:08 pm
Posts: 5
Hi,

Thanks a lot for the replies. The access=field attribute did the trick !!

Priya


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.