Have custom function in a EJB

Posted on 2009-07-01
Last Modified: 2013-11-24

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.PropertyNotFoundException: 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.MySQLSyntaxErrorException: 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?

Question by:Nargzul
  • 3
  • 3

Expert Comment

ID: 24754941
Did you add this function to your interface class?

Author Comment

ID: 24755020
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)

Accepted Solution

serrutom earned 500 total points
ID: 24755977
If you want to add a getter to you EJB class that should not be persisted to the database you should add the @Transient annotation.

public String getTextStatus() {

In you JSF page, did you use TextStatus or textStatus? The first letter of the property should be lower case in your JSF pages, and the error displays a capital T.

Can you post some code?
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails


Author Comment

ID: 24845072
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.

Expert Comment

ID: 24846941
Was your property private or public?

If you have a public property, i think it will also be available and persisted.

Author Comment

ID: 24849164
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.

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
bigHeights  challenge 13 55
word0 challenge 3 56
Python Assistance 7 31
github account with ecipse 1 16
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now