You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@rave.apache.org by Sergio Rivero <sr...@galileasoluciones.com> on 2014/01/10 14:05:14 UTC

Problem adding properties to Users

Hi! My name is Sergio, I'm developing a social network and it's the first
time that I use Apache Rave.

 

When a user create a new account, I need to add a property called "otherID"
(all users have two IDs). 

 

I'm using the following function:

 

       public User addOtherID(User user, String otherID) {

             PersonProperty property = new PersonPropertyImpl("102",
"otherID", otherID, null, "", false);

             List<PersonProperty> properties = user.getProperties();

             properties.add(property);

             user.setProperties(properties);

             return user;

       }

 

I save the returned user in other function with "userRepository.save(user)".

 

The problem: when I go to use that property, the properties of user are
empty.

 

There aren't errors when I compile and execute this function.

 

I'm doing something bad?

 

Best regards,

 

Sergio.

 

 


RE: Problem adding properties to Users

Posted by Sergio Rivero <sr...@galileasoluciones.com>.
I'm using SQL.

That was the problem, I delete the line and work.

The function working:

public User addOtherID(User user, String otherID) {
		
		PersonProperty property = new PersonPropertyImpl();
		property.setType("otherID");
		property.setValue(otherID);
		List<PersonProperty> properties = user.getProperties();
		properties.add(0,property);
		return user;
	}

Thanks for your help :)

-----Mensaje original-----
De: Matt Franklin [mailto:m.ben.franklin@gmail.com] 
Enviado el: miƩrcoles, 15 de enero de 2014 14:42
Para: users@rave.apache.org
Asunto: Re: Problem adding properties to Users

Are you using MongoDB or SQL persistence? SQL is default.

You also shouldn't need to set the properties on the Person object again.


On Fri, Jan 10, 2014 at 8:05 AM, Sergio Rivero <
srivero@galileasoluciones.com> wrote:

> Hi! My name is Sergio, I'm developing a social network and it's the 
> first time that I use Apache Rave.
>
>
>
> When a user create a new account, I need to add a property called
"otherID"
> (all users have two IDs).
>
>
>
> I'm using the following function:
>
>
>
>        public User addOtherID(User user, String otherID) {
>
>              PersonProperty property = new PersonPropertyImpl("102", 
> "otherID", otherID, null, "", false);
>
>              List<PersonProperty> properties = user.getProperties();
>
>              properties.add(property);
>
>              user.setProperties(properties);
>
>              return user;
>
>        }
>
>
>
> I save the returned user in other function with 
> "userRepository.save(user)".
>
>
>
> The problem: when I go to use that property, the properties of user 
> are empty.
>
>
>
> There aren't errors when I compile and execute this function.
>
>
>
> I'm doing something bad?
>
>
>
> Best regards,
>
>
>
> Sergio.
>
>
>
>
>
>


Re: Problem adding properties to Users

Posted by Matt Franklin <m....@gmail.com>.
Are you using MongoDB or SQL persistence? SQL is default.

You also shouldn't need to set the properties on the Person object again.


On Fri, Jan 10, 2014 at 8:05 AM, Sergio Rivero <
srivero@galileasoluciones.com> wrote:

> Hi! My name is Sergio, I'm developing a social network and it's the first
> time that I use Apache Rave.
>
>
>
> When a user create a new account, I need to add a property called "otherID"
> (all users have two IDs).
>
>
>
> I'm using the following function:
>
>
>
>        public User addOtherID(User user, String otherID) {
>
>              PersonProperty property = new PersonPropertyImpl("102",
> "otherID", otherID, null, "", false);
>
>              List<PersonProperty> properties = user.getProperties();
>
>              properties.add(property);
>
>              user.setProperties(properties);
>
>              return user;
>
>        }
>
>
>
> I save the returned user in other function with
> "userRepository.save(user)".
>
>
>
> The problem: when I go to use that property, the properties of user are
> empty.
>
>
>
> There aren't errors when I compile and execute this function.
>
>
>
> I'm doing something bad?
>
>
>
> Best regards,
>
>
>
> Sergio.
>
>
>
>
>
>