Envin
Envin

Reputation: 1523

Trying to use the @transient variable in a different class

I am working on a project that is writing to the database using Hibernate.

I have an Abstract POJO for the model

Removed code

There isn't anything special going on in the subclasses. But I have a controller class that I'm trying to modify some of the data. I want to use the Transient variable, but its not letting me. I am doing this in the other class

REMOVED CODE

Then I call an iterator to take what is in the database and add it to the map. This all is working fine.

My main question, When I do temp.setDescription...it isn't saving a description element in the temp object. Therefore it isn't passing to the map.

Any suggestions? I hope I provided enough information

Upvotes: 0

Views: 124

Answers (2)

Envin
Envin

Reputation: 1523

I figured it out. I didn't have the variable I needed in the hashCode in my model. :)

Upvotes: 0

Chris
Chris

Reputation: 23171

You're never putting "temp" into the map... the only code you have that puts items in the map is:

computerMap.put(hardware.getUuid(), hardware);

For the case where it's a new object, you instantiate a new computer and assign it to temp not hardware so any new computers will never get in the map.

Upvotes: 1

Related Questions