Hi, i'm trying to create a dataservice to conect a database with my datagrid, but i get this errorError: Item requested at index 0 was null and should not have been. Error for service 'usuario' at mx.data::DataList/http://www.macromedia.com/2005/flex/mx/internal::requestItemAt() at mx.data::DataList/getItemAt() at mx.collections::ListCollectionView/getItemAt() at mx.collections::ListCollectionViewCursor/seek() at mx.controls.listclasses::ListBase/modelChanged() at mx.controls::DataGrid/modelChanged() at flash.events::EventDispatcher/dispatchEvent() at mx.collections::ListCollectionView/dispatchEvent() at mx.collections::ListCollectionView/http://www.macromedia.com/2005/flex/mx/internal::reset() at mx.collections::ListCollectionView/mx.collections:ListCollectionView::listChangeHandler() at flash.events::EventDispatcher/dispatchEvent() at mx.data::DataList/http://www.macromedia.com/2005/flex/mx/internal::processSequenceResult() at C:\dev\enterprise_beta1\frameworks\mx\data\errors\DataServiceError.as$34::DataListRequestResponder/result() at mx.rpc::AsyncRequest/acknowledge() at C:\dev\enterprise_beta1\frameworks\libs\framework.swc(mx/core/mx_internal)$35::NetConnectionMessageResponder/result()I'm using:Windows XP servicepack 2Mozilla Firefox 1.5 (i've also tryed ie, but i get the same error)Flex 2.0 beta 1Flex Enterprise Services 2.0 beta 1Flash Player 8.5 Alpha 3 (build 211)
ListaUsuarios.mxmlimport mx.collections.ArrayCollection; import mx.data.DataService; public var ds:DataService; [Bindable] public var usuarios:ArrayCollection; public function initApp() { usuarios = new ArrayCollection(); ds = new DataService("usuario"); ds.fill(usuarios); }
flex-data-service.xmlserviceadaptersadapter-definition id="actionscript" class="flex.data.adapters.ASObjectAdapter" default="true"/adapter-definition id="java-dao" class="flex.data.adapters.JavaAdapter"//adaptersdefault-channelschannel ref="my-rtmp"//default-channelsdestination id="usuario" adapter ref="java-dao" /propertiesmetadataidentity property="idusuario"//metadatanetworksession-timeout0/session-timeoutpaging enabled="false" /throttle-inbound policy="ERROR" max-frequency="500"/throttle-outbound policy="REPLACE" max-frequency="500"//networkserverassemblerclassusuarios.UsuarioAssembler/classsingletontrue/singleton/assemblerfill-methodnameloadUsuarios/name/fill-method/server/properties/destination/service
UsuarioAssembler.javapackage usuarios;import java.util.List;public class UsuarioAssembler{ public List loadUsuarios() { UsuarioDAO dao = new UsuarioDAO(); return dao.getUsuarios(); }}UsuarioDAO.javapackage usuarios;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import java.util.ArrayList;import java.util.List;public class UsuarioDAO{ public List getUsuarios() throws DAOException { ArrayList list = new ArrayList(); Connection c = null; try { c = ConexionBD.getConexion(); Statement s = c.createStatement(); ResultSet rs = s.executeQuery("SELECT * FROM alumnos ORDER BY nombre"); Usuario usuario; while (rs.next()) {usuario = new Usuario();usuario.setIdUsuario(rs.getString("id_usuario"));usuario.setPassword(rs.getString("password"));usuario.setNombre(rs.getString("nombre"));list.add(usuario); } } catch (SQLException e) { e.printStackTrace(); throw new DAOException(e); } finally { ConexionBD.cerrarConexion(c); } return list; }}Everything in java works correctly, but when i try to call it from flex doesn't work.If anybody can help me, i will be very pleased.Thanks in advance.--Manuel Bordallo[EMAIL PROTECTED]
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Web site design development
Computer software development
Software design and development
Macromedia flex
Software development best practice
YAHOO! GROUPS LINKS
Visit your group "flexcoders" on the web.
To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.