title: how to check multiple tables in spring security for authentication
body: <p>I wrote the following code for spring security in applictionContext-Security.xml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/security
      http://www.springframework.org/schema/security/spring-security-3.0.xsd"&gt;
  
  &lt;global-method-security secured-annotations="enabled"&gt;
  &lt;/global-method-security&gt;
  
  &lt;!-- URL pattern based security --&gt;
  
  
  &lt;http auto-config="true"&gt;
      &lt;intercept-url pattern="/common/*" access="ROLE_ADMIN" /&gt;
       &lt;form-login login-page="/login/login.jsp"/&gt;
      &lt;logout logout-success-url="/home/index.jsp"/&gt;
  &lt;/http&gt;
  
  &lt;authentication-manager&gt;
      &lt;authentication-provider&gt;
  
          &lt;!-- &lt;password-encoder hash="md5"/&gt; &lt;user-service&gt; &lt;user name="admin" 
              password="65dc70650690999922d7dcd99dbd4033" authorities="ROLE_ADMIN"/&gt; &lt;/user-service&gt; --&gt;
  
          &lt;jdbc-user-service data-source-ref="dataSource"
              authorities-by-username-query="
              select admin.userName as username, auth.authority as authority from Administrators admin, Authorities auth
              where admin.id=auth.AdministratorId and admin.userName= ?"
              users-by-username-query="select userName as username,hashedPassword as password, enabled as enabled
                                          from Administrators where userName= ?" /&gt;
  
      &lt;/authentication-provider&gt;
  &lt;/authentication-manager&gt;
  
  &lt;/beans:beans&gt;
  </code></pre>
  
  <p>In that xml file, I can only check for administrator table from database for role.
  How can I check for other table such as internal user, administrator and external user table to check for roles? Do I need to write query in new class instead of writing in xml. Please give me any idea or suggestion because I am just start doing it. Give me any link or site or code to view. thanks</p>