Trouble with Database Attribute Mapping

Skip to first unread message

Ryan Richter

Mar 11, 2021, 3:08:21 PMMar 11
to uPortal Community
I am attempting to map attributes based on database queries using

This successfully creates an attribute for my user called "layoutNodesCount" with an integer value when I login.

I have a custom table in the uPortal database with three columns (emplid, student_group, timestamp).

I have the following bean defined in personDirectoryContext.xml:

  <bean id="csucStudentGroupAttributesDao" class="">
    <constructor-arg index="0" ref="PersonDB"/>
        select * CUSTOM_TABLE where {0} and STUDENT_GROUP = 'BLAH'
    <property name="usernameAttributeProvider" ref="usernameAttributeProvider"/>
    <property name="queryAttributeMapping">
        <entry key="emplid" value="EMPLID"/>
    <property name="resultAttributeMapping">
        <entry key="STUDENT_GROUP">

My emplid is in the table and it is an attribute successfully mapped by the LDAP Attribute mapper. The row with my student group is set to BLAH.

I have an attribute successfully created called "student_group" but it is blank instead of being set to BLAH (the value of the student_group column).

Anyone have any idea why this might be happening? I have even gone so far as to hard code the query with my emplid = 'my_emplid_here' instead of using {0} and I get the same result.



Mar 11, 2021, 4:02:46 PMMar 11
to uPortal Community
The one thing that I think the documentation is missing is that you need to merge the attribute sources via a CachingPersonAttributeDaoImpl bean. See

Although the documentation is for uP 4.3, the bean you need is there. Just put the bean in overlays/uPortal/src/main/resources/properties/contextOverrides/overridesContext.xml (or another XML file under overlays/uPortal/src/main/resources/properties/contextOverrides if you prefer)

Hope this helps!

Benito Gonzalez

Mar 12, 2021, 12:23:32 PMMar 12
to jmt, uPortal Community
Hi Ryan,

You seem to have a valid definition. Have you confirmed that your account has an 'empIid' attribute in uPortal already defined and ready to use as a queryAttributeMapping key? You can check with the User Administration portlet. 


You received this message because you are subscribed to the Google Groups "uPortal Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Ryan Richter

Mar 22, 2021, 7:10:18 PMMar 22
to Benito Gonzalez, jmt, uPortal Community
Thanks jmt and bjagg. I've tried the suggestion regarding merging attributes and it didn't make a difference. emplid is an attribute successfully defined (I can see it in attribute swapper, is that enough to verify it's usable for this purpose?)

I think my root problem is at a lower level, I found the following error in catalina.out (this was an attempt to have a query not even be dependent on data in the table, however the original query and several other queries have met with the same error):

org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportFailedQuery Failed Query Report SQL=

                select 'blahs' as layoutNodesCount
                from my_custom_table
            ; time=1615608778770 ms;

  The result was a blank layoutNodesCount attribute.  

Reply all
Reply to author
0 new messages