Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not have a CQLMappedEntityValueConverter on List valueConverters. #25

Open
rjesususa opened this issue Jun 19, 2013 · 10 comments
Open

not have a CQLMappedEntityValueConverter on List valueConverters. #25

rjesususa opened this issue Jun 19, 2013 · 10 comments

Comments

@rjesususa
Copy link

not have a CQLMappedEntityValueConverter on list valueConverters of QueryBuilder.class after initialize application on first execution of query.

then my query return a NULL object, but I have expected a entity.

in second call of query, the class CQLMappedEntityValueConverter is present in list valueConverters, returning my object correctly.

@raulraja
Copy link
Contributor

Can you provide code and how you are initializing the factory?

On Wed, Jun 19, 2013 at 10:00 PM, Raneves notifications@github.com wrote:

not have a CQLMappedEntityValueConverter on list valueConverters of
QueryBuilder.class after initialize application on first execution of query.

then my query return a NULL object, but I have expected a entity.

in second call of query, the class CQLMappedEntityValueConverter is
present in list valueConverters, returning my object correctly.


Reply to this email directly or view it on GitHubhttps://github.com//issues/25
.

Raúl Raja Martínez
Co-founder @ 47 Degrees
h: http://raulraja.com
w: http://47deg.com
t: http://twitter.com/raulraja

@rjesususa
Copy link
Author

the follow code initializing the factory:

                persistenceFactory = new HectorPersistenceFactory();
                persistenceFactory.setAutoDiscoverHosts(true);
                persistenceFactory.setDefaultConsistencyLevel(ConsistencyLevel.ALL);
                persistenceFactory.setEntities(entities);
                persistenceFactory.setClusterName(getProperties().getProperty("clusterName"));
                persistenceFactory.setDefaultKeySpace(getProperties().getProperty("defaultKeySpace"));
                persistenceFactory.setContactNodes(new String[]{ getProperties().getProperty("contactNodes")});
                persistenceFactory.setThriftPort(Integer.parseInt(getProperties().getProperty("rpcPort")));
                persistenceFactory.setPoolName(getProperties().getProperty("poolName"));
                persistenceFactory.setDebug(Boolean.parseBoolean(getProperties().getProperty("debug")));

                persistenceFactory.init();

@rjesususa
Copy link
Author

Query query = Query.get(QueryBuilder.select(QueryBuilder.allColumns(), QueryBuilder.from(entity.getClass()), QueryBuilder.where( QueryBuilder.eq("project", project) )));

project is a column family mapped in my class.

@rjesususa
Copy link
Author

the atribute "entities" is a list of class

@rjesususa
Copy link
Author

any atualization?

@raulraja
Copy link
Contributor

Can you also send the Entity including all mappings?

On Thu, Jun 27, 2013 at 10:09 PM, Raneves notifications@github.com wrote:

any atualization?


Reply to this email directly or view it on GitHubhttps://github.com//issues/25#issuecomment-20151472
.

Raúl Raja Martínez
Co-founder @ 47 Degrees
h: http://raulraja.com
w: http://47deg.com
t: http://twitter.com/raulraja

@rjesususa
Copy link
Author

public class Empresa extends EntityBase
{
private static final long serialVersionUID = -2117279214808111578L;

@Key
private String key;

@Column(indexed = true)
private String nomeEmpresa;

@Mapped
private SegmentoProjeto segmento; // I have use this for query parameter

@Column(validationClass = BytesType.class)
private byte[] logoTipoEmpresa;

/**
 * @return the key
 */
public String getKey()
{
    return key;
}

/**
 * @param key
 *            the key to set
 */
public void setKey(String key)
{
    this.key = key;
}

/**
 * @return the nomeEmpresa
 */
public String getNomeEmpresa()
{
    return nomeEmpresa;
}

/**
 * @param nomeEmpresa
 *            the nomeEmpresa to set
 */
public void setNomeEmpresa(String nomeEmpresa)
{
    this.nomeEmpresa = nomeEmpresa;
}


/**
 * @return the segmento
 */
public SegmentoProjeto getSegmento()
{
    return segmento;
}

/**
 * @param segmento the segmento to set
 */
public void setSegmento(SegmentoProjeto segmento)
{
    this.segmento = segmento;
}

/**
 * @return the logoTipoEmpresa
 */
public byte[] getLogoTipoEmpresa()
{
    return logoTipoEmpresa;
}

/**
 * @param logoTipoEmpresa the logoTipoEmpresa to set
 */
public void setLogoTipoEmpresa(byte[] logoTipoEmpresa)
{
    this.logoTipoEmpresa = logoTipoEmpresa;
}

public String getId()
{
    return key;
}

public void setId(String id)
{
    key = id;
}

}

in my query i use segmento in clausule where.

Query query = Query.get(QueryBuilder.select(QueryBuilder.allColumns(), QueryBuilder.from(Empresa.class), QueryBuilder.where( QueryBuilder.eq("segmento", segmento) )));

entity segmento is:

public class SegmentoProjeto extends EntityBase
{

private static final long serialVersionUID = -8185147223966996268L;

@Key
private String key;

@Column(indexed = true)
private String nomeSegmento;


/**
 * @return the key
 */
public String getKey()
{
    return key;
}

/**
 * @param key the key to set
 */
public void setKey(String key)
{
    this.key = key;
}

/**
 * @return the nomeSegmento
 */
public String getNomeSegmento()
{
    return nomeSegmento;
}

/**
 * @param nomeSegmento the nomeSegmento to set
 */
public void setNomeSegmento(String nomeSegmento)
{
    this.nomeSegmento = nomeSegmento;
}

public String getId()
{
    return key;
}

public void setId(String id)
{
    key = id;

}

}

@raulraja
Copy link
Contributor

raulraja commented Jul 1, 2013

What is the code that you are using to pass the query to the factory and retrieve the List of objects?

@rjesususa
Copy link
Author

Query query = Query.get(QueryBuilder.select(QueryBuilder.allColumns(), QueryBuilder.from(Empresa.class), QueryBuilder.where( QueryBuilder.eq("segmento", segmento) )));

response = getPersistenceFactory().getSingleResult(Empresa.class, query);

@rjesususa
Copy link
Author

is important execute this query on first time after startup server application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants