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

update entity with null property @MappedCollection don't remove column in column family #27

Open
rjesususa opened this issue Jul 30, 2013 · 6 comments

Comments

@rjesususa
Copy link

Well, if I have been updated an entity with NULL value on @MappedCollection property in cassandra database, these column doesn't are removed.
it causes the follow exception:

Caused by: java.lang.ClassNotFoundException:
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.firebrandocm.dao.AbstractPersistenceFactory.loadMappedCollection(AbstractPersistenceFactory.java:967)
at org.firebrandocm.dao.AbstractPersistenceFactory.loadProperty(AbstractPersistenceFactory.java:934)
at org.firebrandocm.dao.impl.hector.HectorPersistenceFactory.loadLazyPropertyIfNecessary(HectorPersistenceFactory.java:537)
at org.firebrandocm.dao.ClassMetadata$2.invoke(ClassMetadata.java:532)
at br.com.mca.comissionamento.mcadominio.server.persistence.domain.TermoAberturaProjeto_$$javassist_23.getDocumentos(TermoAberturaProjeto$$_javassist_23.java)

When I try access the list property: tap.getDocumentos()

tap is this entity:
public class TermoAberturaProjeto extends EntityBase
{
private static final long serialVersionUID = -8093038817100592845L;

@Key
private String key;

@MappedCollection
private List<DocumentoReferencia> documentos;

...
}

@raulraja
Copy link
Contributor

While the reported exception is cryptic and can be improved firebrand maps
collections by composing a String containing the class name and target id
and does not support at this time discovering removed relationships outside
of firebrand. Can you provide a test case for this use case? I'll be happy
to look into it once I understand more what the actual case and provide
either better exception handling for missing collection items or a fix for
it.

On Tue, Jul 30, 2013 at 11:48 PM, Raneves notifications@github.com wrote:

Well, if I have been updated an entity with NULL value on
@MappedCollection property in cassandra database, these column doesn't are
removed.
it causes the follow exception:

Caused by: java.lang.ClassNotFoundException:
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at
org.firebrandocm.dao.AbstractPersistenceFactory.loadMappedCollection(AbstractPersistenceFactory.java:967)
at
org.firebrandocm.dao.AbstractPersistenceFactory.loadProperty(AbstractPersistenceFactory.java:934)
at
org.firebrandocm.dao.impl.hector.HectorPersistenceFactory.loadLazyPropertyIfNecessary(HectorPersistenceFactory.java:537)
at org.firebrandocm.dao.ClassMetadata$2.invoke(ClassMetadata.java:532)
at
br.com.mca.comissionamento.mcadominio.server.persistence.domain.TermoAberturaProjeto_$$javassist_23.getDocumentos(TermoAberturaProjeto$$_javassist_23.java)

When I try access the list property: tap.getDocumentos()

tap is this entity:
public class TermoAberturaProjeto extends EntityBase
{
private static final long serialVersionUID = -8093038817100592845L;

@key
private String key;

@MappedCollection
private List documentos;

...
}


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

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

Raul, the updated is execute on firebrand method.
look this example with TermoAberturaProjeto class:

//my dao retrieve the entity from DB.
TermoAberturaProjeto tap = dao.get(TermoAberturaProjeto.class, id);
tap.setDocumentos(null); // or a ArrayList size equals 0
dao.update(tap); // execute method persist of firebrand.

on it's case, the column reference of property documentos(List with @MappedCollection) don't is removed on cassandra and the value of the column is empty.
=> (column=documentos, value=, timestamp=1375220612449000)

so, i have exceptions when try execute the simple method get of my atribute.

like this:

TermoAberturaProjeto tap = dao.get(TermoAberturaProjeto.class, id);
tap.getDocumentos(); // this throws exception when I try access the list property.

@raulraja
Copy link
Contributor

I see, it is indeed a bug that an exception is thrown in this case. I will
look into it and fix it as soon as I have some time. Thanks for reporting
it!
On Jul 31, 2013 12:29 AM, "Raneves" notifications@github.com wrote:

Raul, the updated is execute on firebrand method.
look this example with TermoAberturaProjeto class:

//my dao retrieve the entity from DB.
TermoAberturaProjeto tap = dao.get(TermoAberturaProjeto.class, id);
tap.setDocumentos(null); // or a ArrayList size equals 0
dao.update(tap); // execute method persist of firebrand.

on it's case, the column reference of property documentos(List with
@MappedCollection) don't is removed on cassandra and the value of the
column is empty.
=> (column=documentos, value=, timestamp=1375220612449000)

so, i have exceptions when try execute the simple method get of my
atribute.

like this:

TermoAberturaProjeto tap = dao.get(TermoAberturaProjeto.class, id);
tap.getDocumentos(); // this throws exception when I try access the list
property.


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

@fzoro
Copy link
Contributor

fzoro commented Sep 19, 2013

Hello Raul, are you ok?

You'll fix this issue?

@rjesususa
Copy link
Author

?

@raulraja
Copy link
Contributor

@fabiozoroastro @raneves I have been very busy lately and not had much time to dedicate to this issue. If you need an immediate fix I'll be happy to review any PR's. Thx

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

3 participants