Ajuda com métodos

Olá pessoal, estou com dificuldades em encontrar o erro em duas linhas de dois pacotes meus, seguem os códigos

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		context = getApplicationContext();
		
		TabelaService tabelaService = new TabelaService(context);
		
		List<JSONObject> listaTabela = tabelaService.getPorIdade("16"); //erro a partir do sinal '='

//		if (!isIdentificado()) {
//			enviarParaIdentificacao();
//		}
	}
package com.canalsac.galardaomobile.service;

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

import org.json.JSONException;
import org.json.JSONObject;

import android.content.Context;

import com.canalsac.galardaomobile.dao.TabelaDAO;
import com.canalsac.galardaomobile.modelo.Tabela;

public class TabelaService 
{
	private TabelaDAO tabelaDao;
	
	public TabelaService(Context context)
	{
		tabelaDao = new TabelaDAO(context);		
	}
		
	public Tabela getPorIdade(String idade)
	{
		JSONObject tabela = tabelaDao.getPorIdade(idade); //erro a partir do sinal '='
		
		Tabela tabelaBuscada = null;
		
		if (tabela != null && tabela.length() >1)
		{
			tabelaBuscada = new Tabela();
			
			try
			{
				tabelaBuscada.setIdade(tabela.getString(Tabela.COLUMN_NAME_IDADE));
				tabelaBuscada.setCapital(tabela.getString(Tabela.COLUMN_NAME_CAPITAL));
				tabelaBuscada.setProduto(tabela.getString(Tabela.COLUMN_NAME_PRODUTO));
				tabelaBuscada.setMensalidade(tabela.getString(Tabela.COLUMN_NAME_MENSALIDADE));
			}
			catch(JSONException e)
			{
				e.printStackTrace();
			}
		}
		
		return tabelaBuscada;
		
	}
}

E a minha DAO que está sem erro

package com.canalsac.galardaomobile.dao;

import java.util.ArrayList;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import com.canalsac.galardaomobile.modelo.Tabela;
import com.canalsac.galardaomobile.persistencedatabase.TabelaDbHelper;


import android.content.Context;

public class TabelaDAO 
{
	private static final String SELECT_ALL = "select * from "+Tabela.TABLE_NAME;
	
	private static SQLiteDatabase db;
	private TabelaDbHelper tabelaDbHelper;
	
	public TabelaDAO(Context context)
	{ 
		tabelaDbHelper = new TabelaDbHelper(context);
		db = tabelaDbHelper.getDatabase();
	}
	
	public List<JSONObject> getPorIdade(String idade) 
	{
		List<JSONObject> result = new ArrayList<JSONObject>();      
		
		Cursor cursor = db.rawQuery(SELECT_ALL +" where idade = "+idade+";", null);
		
		cursor.moveToFirst();
		while(!cursor.isAfterLast())
		{
			JSONObject a = readRow(cursor);
			result.add(a);
			cursor.moveToNext();
		}
		
		cursor.close();
		return result;
	}
	
	private JSONObject readRow(Cursor cursor)
	{
		JSONObject obj = new JSONObject();
		
		try
		{
			obj.put(Tabela.COLUMN_NAME_MENSALIDADE, cursor.getString(0));
			obj.put(Tabela.COLUMN_NAME_PRODUTO, cursor.getString(1));
			obj.put(Tabela.COLUMN_NAME_CAPITAL, cursor.getString(2));
			obj.put(Tabela.COLUMN_NAME_IDADE, cursor.getString(3));
			
		}
		catch(JSONException e)
		{
			
		}
		
		return obj;
}

}

O que eu fiz de errado nos meus métodos?
A minha Main está chamando a Service mas a Service não está chamando a DAO.
Os erros eu comentei.

Boas,

Você consegui debugar esse método? Se possível, ao chegar nessas linhas “onde o erro ocorre”, debugue dando um “Step Into”.

Se der põe o log de erro.

No primeiro metodo vc está retornando uma tabela e não uma lista de JsonObject

Vc está pedindo uma lista de JSONObject

TabelaService tabelaService = new TabelaService(context);
List<JSONObject> listaTabela = tabelaService.getPorIdade("16");

Mas na TabelaService vc está retornando um objeto do tipo Tabela

public Tabela getPorIdade(String idade)

Vc precisa fazer o que o método que funciona está fazendo, desse jeito (Retornar um List) entendeu!?

public List<JSONObject> getPorIdade(String idade)   

Ajudou e está funcionando o select (=

mas meu diagrama tem que ficar assim

https://mail-attachment.googleusercontent.com/attachment/u/1/?ui=2&ik=8b29e391f8&view=att&th=13d6972a972612e3&attid=0.1&disp=inline&realattid=f_hea1ydqi1&safe=1&zw&saduie=AG9B_P_2cLTowdvVoPIxoCxQD7Zx&sadet=1363273826739&sads=y1ebeCpWpAPaDlRrP9M9CqDR9J8&sadssc=1

Mas aí eu mudo minha TabelaService para o tipo List e já acusa erro no return dela e na minha classe Main.

Posta como ficou seu código!
Esse link que vc passou precisa de uma senha especifica para entrar no grupo!

Meu main e minha service de acordo com o diagrama

[code]public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

	context = getApplicationContext();
	
	TabelaService tabelaService = new TabelaService(context);
	
	List<Tabela> tabela = tabelaService.getPorIdade("16"); 

// if (!isIdentificado()) {
// enviarParaIdentificacao();
// }
}
[/code]

public class TabelaService 
{
	private TabelaDAO tabelaDao;
	
	public TabelaService(Context context)
	{
		tabelaDao = new TabelaDAO(context);		
	}
		
	public List<Tabela> getPorIdade(String idade)
	{
		List<Tabela> tabela = tabelaDao.getPorIdade(idade);
		return tabela; 		
	}
}

Estou com erro na DAO, bem nesse return result

	public List<Tabela> getPorIdade(String idade) 
	{
		List<JSONObject> result = new ArrayList<JSONObject>();      
		
		Cursor cursor = db.rawQuery(SELECT_ALL +" where idade = "+idade+";", null);
		
		cursor.moveToFirst();
		while(!cursor.isAfterLast())
		{
			JSONObject a = readRow(cursor);
			result.add(a);
			cursor.moveToNext();
		}
		
		cursor.close();
		return result;
	}

Vc está com erro nela porque vc está pedindo para retornar uma List e está retornando uma List!!!


    public List<Tabela> getPorIdade(String idade)  //Esta pedindo uma List<Tabela> como retorno
    {  
        List<JSONObject> result = new ArrayList<JSONObject>(); //Esta criando uma List<JSONObject>       
          
        Cursor cursor = db.rawQuery(SELECT_ALL +" where idade = "+idade+";", null);  
          
        cursor.moveToFirst();  
        while(!cursor.isAfterLast())  
        {  
            JSONObject a = readRow(cursor);  
            result.add(a);  
            cursor.moveToNext();  
        }  
          
        cursor.close();  
        return result;  //Esta retornando a List<JSONObject> e nao uma List<Tabela>
    }  

Voce so precisa decidir com qual objeto vc vai realmente trabalhar!!

Obs*: Eu nao estou conseguindo ver o diagrama do qual vc esta falando, o link que vc me passou não he possivel visualizar pois pede uma senha do grupo!!