0 Replies Latest reply on Aug 2, 2013 9:44 AM by Nicola Ben

    PicketLink: change default schema for its tables

    Nicola Ben Novice

      Hi,

      I am integrating my application with picketLink 2.5.0beta5.

       

      I'd like to have all picketlink's table in a schema called "security".

      So I added a orm.xml file inside my.app.model package

       

      ORM.XML:

       

      <entity-mappings version="2.0"

                xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd">

       

          <package>org.picketlink.idm.jpa.schema</package>

         <schema>security</schema>

       

      </entity-mappings>

       

      and add to persistence.xml these lines:

       

      <mapping-file>my/app/model/orm.xml</mapping-file>

       

                          <class>org.picketlink.idm.jpa.schema.IdentityObject</class>

                          <class>org.picketlink.idm.jpa.schema.PartitionObject</class>

                          <class>org.picketlink.idm.jpa.schema.RelationshipObject</class>

                          <class>org.picketlink.idm.jpa.schema.RelationshipIdentityObject</class>

                          <class>org.picketlink.idm.jpa.schema.RelationshipIdentityWeakObject</class>

                          <class>org.picketlink.idm.jpa.schema.RelationshipObjectAttribute</class>

                          <class>org.picketlink.idm.jpa.schema.IdentityObjectAttribute</class>

                          <class>org.picketlink.idm.jpa.schema.CredentialObject</class>

                          <class>org.picketlink.idm.jpa.schema.CredentialObjectAttribute</class>

       

       

      Running my app in jboss-7.1.1 tables and schema are detected:

       

      15:15:43,146 INFO  [org.hibernate.tool.hbm2ddl.SchemaValidator] (MSC service thread 1-1) HHH000229: Running schema validator

      15:15:43,146 INFO  [org.hibernate.tool.hbm2ddl.SchemaValidator] (MSC service thread 1-1) HHH000102: Fetching database metadata

      15:15:43,155 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000261: Table found: security.credentialobject

      15:15:43,156 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000037: Columns: [id, identitytype_id, type, expirydate, credential, effectivedate]

      15:15:43,160 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000261: Table found: security.credentialobjectattribute

      15:15:43,160 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000037: Columns: [id, credentialobject_id, name, value]

      15:15:43,164 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000261: Table found: security.identityobject

      15:15:43,164 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000037: Columns: [id, loginname, enabled, partition_id, grouppath, email, name, discriminator, lastname, firstname, expirydate, creationdate, parent_id]

      15:15:43,169 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000261: Table found: security.identityobjectattribute

      15:15:43,170 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000037: Columns: [id, identityobject_id, name, value, type]

      15:15:43,175 INFO  [org.hibernate.tool.hbm2ddl.TableMetadata] (MSC service thread 1-1) HHH000261: Table found: security.partitionobject

       

       

      but at the end it seems that a query is executed outside the schema "security" but in public schema:

       

      15:15:44,956 INFO  [org.picketlink.common] (MSC service thread 1-11) Using logger implementation: org.picketlink.common.DefaultPicketLinkLogger

      15:15:44,984 INFO  [stdout] (MSC service thread 1-11) Hibernate: select identityob0_.id as id84_, identityob0_.creationDate as creation2_84_, identityob0_.discriminator as discrimi3_84_, identityob0_.email as email84_, identityob0_.enabled as enabled84_, identityob0_.expiryDate as expiryDate84_, identityob0_.firstName as firstName84_, identityob0_.groupPath as groupPath84_, identityob0_.lastName as lastName84_, identityob0_.loginName as loginName84_, identityob0_.name as name84_, identityob0_.parent_id as parent12_84_, identityob0_.partition_id as partition13_84_ from IdentityObject identityob0_ inner join PartitionObject partitiono1_ on identityob0_.partition_id=partitiono1_.id where identityob0_.discriminator=? and (partitiono1_.id in (? , ? , ?)) and identityob0_.loginName=? order by identityob0_.loginName asc

      15:15:44,994 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (MSC service thread 1-11) SQL Error: 0, SQLState: 42P01

      15:15:44,994 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (MSC service thread 1-11) ERROR: relation "identityobject" does not exist  Position: 511

       

       

      Did some of you try to change schema and found the same problems?

       

      Thank you in advance,

      Nicola