Nargzul
asked on
Have custom function in a EJB
Hi,
I've a integer field in the database, that represent a status. I want to display a text instead of this textField. So I've added a function called
public getTextStatus(){
....
}
But when I do this, I've this error:
Caused by: javax.el.PropertyNotFoundE xception: The class 'datamodel.Deal' does not have the property 'TextStatus'.
After this I've tried to add a fake EJB field and I've now this error.
Internal Exception: com.mysql.jdbc.exceptions. jdbc4.MySQ LSyntaxErr orExceptio n: Unknown column 'TEXTSTATUS' in 'field list'
I understand theses errors but I don't know how to bypass them.
Why generating this in the EJB? Because I need to display it in a table, (rich:datatable), and I was thinking it was the easier way.
Have you an idea?
Thanks!
I've a integer field in the database, that represent a status. I want to display a text instead of this textField. So I've added a function called
public getTextStatus(){
....
}
But when I do this, I've this error:
Caused by: javax.el.PropertyNotFoundE
After this I've tried to add a fake EJB field and I've now this error.
Internal Exception: com.mysql.jdbc.exceptions.
I understand theses errors but I don't know how to bypass them.
Why generating this in the EJB? Because I need to display it in a table, (rich:datatable), and I was thinking it was the easier way.
Have you an idea?
Thanks!
Did you add this function to your interface class?
ASKER
Not really, because the EJB itself doesn't have an interface.
I've added this function to the entity, and after I use a session bean to access it(and this session bean has interfaces)
I've added this function to the entity, and after I use a session bean to access it(and this session bean has interfaces)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
When I add the @Transient before my getter, I got one error from netbeans, saying me the "There is no ID defined for this entity hierarchy"
I don't really know what changed, but now, without properties, only with a getter, it works.
It's maybe the Maj problem as you said. Thanks you for your help.
I don't really know what changed, but now, without properties, only with a getter, it works.
It's maybe the Maj problem as you said. Thanks you for your help.
Was your property private or public?
If you have a public property, i think it will also be available and persisted.
If you have a public property, i think it will also be available and persisted.
ASKER
I wasn't having a property, only getters and setters,
In fact the getter only take a String in an array, depending of the value of a persistent field.
In fact the getter only take a String in an array, depending of the value of a persistent field.