Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9237293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:30:16+00:00 2026-06-18T07:30:16+00:00

I already read a lot of questions here about this same problem, and I

  • 0

I already read a lot of questions here about this same problem, and I can assure you that is not the EQUALs method, and also, it is not a problem as the bean scope. So, lets see what is happening.

I have this selectOne, that is working ‘partially’

                <p:selectOneMenu id="acao" converter="#{acaoConverter}" value="#{prospectoRadarController.acaoSelecionada}">
                    <f:selectItem itemLabel="#{msg['label.selecione.item']}" itemValue="" />
                    <f:selectItems var="a" itemValue="#{a}" itemLabel="#{a.descricao}" value="#{acaoController.listarAcoesEmAberto()}" />
                </p:selectOneMenu>

So I have the ‘Acao’ entity. All the entities are completly valid, as the HTML of the select is also correct (the value is the correct ID of the entity).

The data that I imported (using an SQL file) check out the last two lines:

            INSERT INTO com_acao VALUES (190, 0.00, '2012-12-31', '2012-12-31', '2012-12-31', 'SELECIONADOS 2012-1', 0, 1, 1);
            ALTER SEQUENCE com_acao_id_seq RESTART WITH 191;

Ok then, If i INSERT a new entity, it inserts correctly, with the right ID, and everything works fine.

THE PROBLEM: On that SelectOneMenu, if I choose an entity that was imported with the SQL file, it works. If I choose a new entity, that I saved using the system, I get the:

  javax.faces.component.UISelectOne.INVALID

Validation error. So again, the equals is not broken. My best bet is that this is Hibernate related. But…. HOW come it adds, filters, searches for the entity, and no errors occurrs? Only the validation error is happening ? 🙁

This is the entity ID declaration:

   public class Acao {

     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Integer id;

Thanks !
My Repositories are Spring Data’s PagingAndSorting interface. I don´t know if this is a relevant information… If you guys need any info, just ask! Thanks again!

UPDATE
The method that loads the list of “Acao” to be displayed on the SelectItems:

public List<Acao> listarAcoesEmAberto() {
    return acaoService.listarAcoesEmAberto();
}

With is this Query executed:

@Query("select a from Acao a where a.dataFinal is null OR current_date() <= a.dataFinal")
public List<Acao> listarAcoesEmAberto();

UPDATE 2 The converter methods:

@SuppressWarnings("unchecked")
@Override
public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
    if (arg2 == null || arg2.equals("")) {
        return null;
    }

    try {
        return baseService.findOne((PK) new SimpleTypeConverter().convertIfNecessary(arg2, ReflectUtil.getPrimaryKeyField(entityClass).getType()));
    } catch (TypeMismatchException e) {
        return null;
    }
}

@Override
public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
    if (arg2 == null) {
        return "";
    }

    return arg2.toString();
}

NOTE: this is a generic converter. The real converter is:

@Component
@Scope(“request”)
public class AcaoConverter extends BaseConverter implements Serializable {

private static final long serialVersionUID = 1L;

@Autowired
public AcaoConverter(AcaoService acaoService) {
    super(acaoService, Acao.class); 
}

So its the same converter for ALL of the entities. And it works.
Why not for this particular case? 🙁

UPDATE 3 Lets see the problem better…

This is the imported row from the sql file:
a

This is a row that I created using the program:
2

This is the same on the database (so it is commited):
3

This is the SELECT:
4

The HTML:
5

SUCESS CASE (selecting the imported row):
6

ERROR CASE (selecting the created row):
7

UPDATE 4 WOW ! I tested with some other entities that where imported, and… Some of them doesn´t work. So, bottom line: new entities doesn´t work, and some imported entities doesn´t work! Looking at the database, they are all fine data, nothing missing or violations. So wierd!

Another thing.. with autoComplete component it works!!!! (everything works)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:30:17+00:00Added an answer on June 18, 2026 at 7:30 am

    Well,

    no solution for selectOneMenu.
    So I used an autoComplete with dropdown (true).

    It works fine.

    So, this is not really a solution, but a workaround.
    Thanks all for the help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've read a lot on this topic already both here (e.g., stackoverflow.com/questions/1713554/threads-processes-vs-multithreading-multi-core-multiprocessor-how-they-are or multi-CPU,
I already read many article about this issue in here, SO. I just want
First of all I already read about all this discussion that it isn't a
Scenario Having already read a post on this on the same site, which didn't
I've already read through the similar questions on this topic, but none of them
I hope this is not a dumb question, since I've already googled and read
I know there's already a lot of questions on this topic but I might
This question is quite popular, and there are already lot of questions pertaining to
I know that a lot of c/c++ XML library questions have been asked already
I've already read this but it doesn't answer to my question. Here's my scenario:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.