Hello:)
Our test was:
1. Add attribute with alias="test"
mysql> select * from jos_attribute;
+----------------------------------
+-----------------.........................+
| attribute_id | attribute_alias
|
+----------------------------------
+-----------------..........................+
| 4108a7991ccc5e6f011ccc5ef8470001 | teste |
2. Add value "a" to attribute "test"
mysql> select * from jos_attribute_value;
+----------------------------------+----------------------------------
+-----------------------+-----------------------+
| attribute_value_user_id |
attribute_value_attribute_id | attribute_value_index |
attribute_value_value |
+----------------------------------+----------------------------------
+-----------------------+-----------------------+
| 4108a7991ccc5e6f011ccc5ef8470001 | 4108a7991ccc5e6f011ccc5ef8470001
| 0 | a |
so far so good.
3. Add attribute "test2" and value of "test2" = "b". The server
stopped working, with error
" OpenID is Unavailable [...] "
Now watch this:
mysql> select * from jos_attribute_value;
+----------------------------------+----------------------------------
+-----------------------+-----------------------+
| attribute_value_user_id | attribute_value_attribute_id
| attribute_value_index | attribute_value_value |
+----------------------------------+----------------------------------
+-----------------------+-----------------------+
| 4108a7991ccc59b4011ccc5af12b0002 | 4108a7991ccc5e6f011ccc5ef8470001
| 0 | a |
| 4108a7991ccc59b4011ccc5af12b0002 | 4108a7991ccc5e6f011ccc6179120002
| 0 | |
see what's the problem? Attribute_value_index is allways '0'
4. To see if the problem was on the database we added those lines
(with mysql command):
mysql> select * from jos_attribute_value;
+----------------------------------+----------------------------------
+-----------------------+-----------------------+
| attribute_value_user_id | attribute_value_attribute_id
| attribute_value_index | attribute_value_value |
+----------------------------------+----------------------------------
+-----------------------+-----------------------+
| 4108a7991ccc59b4011ccc5af12b0002 | 4108a7991ccc5e6f011ccc5ef8470001
| 0 | a |
| 4108a7991ccc59b4011ccc5af12b0002 | 4108a7991ccc5e6f011ccc6179120002
| 1 | b |
And it worked, so the problem must be the attribute_value_index. It
should be a value that auto-increments.
To try to fix this i did:
5. changed jos-hibernate/.../attributeValue.hbm.xml to:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN" "
http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="cn.net.openid.jos.domain">
<class name="AttributeValue" table="jos_attribute_value">
<many-to-one name="user" column="attribute_value_user_id" />
<many-to-one name="attribute" column="attribute_value_attribute_id" /
>
<id name="index" column="attribute_value_index" >
<generator class="uuid"/>
</id>
<property name="value" column="attribute_value_value" />
</class>
</hibernate-mapping>
So that the column="attribute_value_index" would be like an id
attribute, i mean, auto-increment and unique
6. created the jar (that is exactly the same as jos-
hibernate-1.2.0.jar except on attributevalue.hbm.xml) and added the
classpath of this file on dataAccessContext-hibernate.xml to the list
of xml files that existed.
7. ERROR! ERROR! ERROR! Everything stopped working :( To get it to
work again i had to put everything like it was before so i'm thinking
that the xml that i wrote is all wrong;)
If we fix this the server would work perfectly and we would be able to
add these attributes to the persona:)