Create custom Table

Showing results for 
Search instead for 
Did you mean: 
Established Member II

Create custom Table


I have developed Alfreco/Angular app and i need to store user settings/preference in order to customize dashboard

There is no link with Alfresco data or alfresco dashboard

Is-it possible to store this kind of data in new custom Table in Alfresco database ?

Thank you

6 Replies

Re: Create custom Table

Don't pollute the Alfresco database with unrelated tables. Instead, create your own database instance and put your tables there. If you ignore this advice you could be sorry when you do your first upgrade.


Re: Create custom Table

Also, familiarize yourself with the existing Alfresco services. There already is a PreferenceService in the Repository-tier which can be used to store user preferences. The REST v1 API also exposes this.

Established Member II

Re: Create custom Table


so can I use Alfresco 5 Hibernate libs to create another database ? I make some test without success ?

spring - Alfresco 5.2 - Hibernate - Stack Overflow 

Is it possible to do it ? I found Hibernate-3.2.6-alf-20131023 jar in C:\alfresco-community\tomcat\webapps\alfresco\WEB-INF\lib so I suppose it's possible, no ?

Thank you in advance


Re: Create custom Table

Do NOT use Hibernate at all (even if ignoring Jeff's advice of not creating custom tables) - Hibernate has been removed in Alfresco 6, so you would set yourself up for failure in the future if you developed something using Hibernate.

Established Member II

Re: Create custom Table

Thank you Axel !

So can you help me to finalize my config xml file, please...I have spend 2 days without to succeed !!

I have removed all Hibernate references : 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
   <property name="driverClassName" value="org.postgresql.Driver" />
   <property name="url" value="jdbcSmiley Tongueostgresql://localhost:5432/klinck" />
   <property name="username" value="postgres" />
   <property name="password" value="admin" />

<bean id="myEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
   <property name="dataSource" ref="dataSource" />
   <property name="persistenceUnitName" value="?????" />
   <property name="packagesToScan" value="" />

<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
   <property name="entityManagerFactory" ref="myEmf" />
<tx:annotation-driven />


I get the following error :

Caused by: java.lang.IllegalArgumentException: No PersistenceProvider specified in EntityManagerFactory configuration, and chosen PersistenceUnitInfo does not specify a provider class name either

And ALL informations , founded on the web, about PersistenceProvider refer to Hibernate : 

Quickly,  several config founded on the web:

- exemple 1 : 

"org.hibernate.ejb.HibernatePersistence"  or <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>

- exemple 2 :

<property name="jpaProperties">
<prop key="">none</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>

exemple 3 : 

<bean id="hibernateVendor" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true" />

(see on stackoverflow, Spring ...)

What is missing ? I know Alfresco Spring version is 3.2.17.RELEASE but I don't find how to do WITHOUT Hibernate !

THANK YOU IN ADVANCE, it makes me crazy !!


Re: Create custom Table

If you really must, you should use MyBatis / iBatis for any custom SQL interaction, since this is what Alfresco uses and will continue to use since there has been no announcement / indication they are refacatoring anything in their DAO layer. (Again, think long and hard if this is the right thing to do.)

You can see an example of MyBatis / iBatis use in one of my addons where I have used it to implement an incremental cleanup mechanism for data in the alf_prop_* tables as an alternative to the default, all-or-nothing cleanup job provided by Alfresco (which was based on a script of mine). Start with the dao-context.xml and then check the SQL mapping files for specific queries.

Note that this example works with the existing Alfresco database connection, but can easily be adapted to work with another database by providing a different data source and transaction manager. The basis for these can be taken from the original Alfresco config.