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 3353822
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:11:53+00:00 2026-05-18T02:11:53+00:00

So I’m going to be using Flex 4 with Spring and Hibernate. Everything is

  • 0

So I’m going to be using Flex 4 with Spring and Hibernate.
Everything is configured and working. I know this as I can do simple queries, like listing all values in a table.
Problem is when I try to perform a ‘select’ query, then I get all the values, as I was getting before, and not the specific attributes through Select query.

I’m a beginner, so kindly overlook my lack of more technically sound words..but I don use them as I don wanna mis-quote.

Following is some code which will make You understand things better:
This is class used to store data coming from the MySQL database–

package flex;


import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;



@Entity
@Table(name="intrial1")
public class intrial1 implements Serializable {

    @Id @GeneratedValue
    @Column( name = "id")
    private int id;
    @Column( name = "name")
    private String name;



    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    }

This is the class where the sessionFactory does things(too many import statements, just to try to make things work-ignore)–

package flex;

import java.util.ArrayList;
import java.util.List;


import javax.persistence.Query;
import org.hibernate.SessionFactory;
import org.hibernate.annotations.NamedNativeQueries;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.flex.remoting.RemotingInclude;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;



import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import org.springframework.transaction.annotation.Transactional;




@Repository
@RemotingDestination
public class SpringBean_Service  {


    private SessionFactory sessionFactory;

    @Autowired
    public void setSessionFactory(SessionFactory factory) {
        sessionFactory = factory;
    }

    @SuppressWarnings("unchecked")
    @RemotingInclude
    @Transactional
    public List<intrial1> getList() {

        return sessionFactory.getCurrentSession().createQuery("from intrial1 ").list();
    }

    @SuppressWarnings("unchecked")
    @RemotingInclude
    @Transactional
    public List<intrial1> getListAgain() {



        org.hibernate.Query q = sessionFactory.getCurrentSession().createQuery("select id from intrial1 where name='chirayu'");
        List l = q.list();
        return l; 


    }


    @RemotingInclude
    @Transactional
    public void createFriend(String name, int id) {
        intrial1 f = new intrial1();
        f.setName(name);
        f.setId(id);
        sessionFactory.getCurrentSession().save(f);

}
}

In above class, getList() works
perfect, lists all the values. The
createFriend is used to enter values
of id+name, and works smoothly. The
problem is with getListAgain()
function, it gives me a result,
imagine 2 columns, having heading as
‘id’ and ‘name’, but listing id values
in both the columns (No names), As You
can understand, I am looking for
result of getListAgain() function as –
“1 column having header as ‘id’, and
listing id wherever the name
=’chirayu'”.

Kindly help, as I will need to clear this and move ahead with development.
Thank You.

Regards,
Chirayu

UPDATE NOTE: Would like to say one thing here, if only I make a class as below, which is identical to intrial1 class, but has no return statement for name, i.e., no getName() defined, I get my correct result for the query –

‘select id from intrial1 where
name=’chirayu”

package flex;


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;



@Entity

public class intrial2 {

    @Id @GeneratedValue
    @Column( name = "id")
    private int id;
    @Column( name = "name")
    private String name;




    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }


    public void setName(String name) {
        this.name = name;
    }

    }

Is this strange or meant to be like this. Still looking for answers.

  • 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-05-18T02:11:54+00:00Added an answer on May 18, 2026 at 2:11 am

    The query

    select id from intrial1 where name='chirayu'
    

    doesn’t return intrial1 entity, so you should change return type to List or simply change your query to:

    from intrial1 where name='chirayu'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.