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:[email protected]]
Enviado el: miƩrcoles, 15 de enero de 2014 14:42
Para: [email protected]
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 <
[email protected]> 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.
>
>
>
>
>
>