1 Reply Latest reply: Mar 3, 2012 3:13 AM by Christian Kaltepoth RSS

value of number is set 0

H Dam Newbie

Hi everyone,

 

I have a problem, and I don't know why. I have property testObject with the following declaration:

 

@Named
@ConversationScoped
@LoggedIn
public class TestController implements Serializable {
     @Inject
     private EntityManager em;

     @Produces
     @Named
     private TestObject testObject;
..................
     public void register() {
          em.persist(testObject);
     }
..................
}

 

In TestObject I have the number field

 

@Entity
public class TestObject implements Serializable {
..........
     private BigDecimal price;
..........
}

 

On the JSF page, user not input value for testObject.price and submit form to register by invoke method #{testController.register} from JSF page, the testObject.price become 0. In this case, I think value of  testObject.price should be null. What is problem?