Search code examples
liferay

Can Liferay custom fields for User Resource created can be accessed in DB?


Can Liferay custom fields for User Resource created can be accessed in DB I have created custom fields for User Resource through below steps

  1. Control Panel -> Configuration -> Custom Fields
  2. Then choose a resource, User, click on the Edit link next to it and select Add Custom Field. And the field is getting displayed, But can we access it through liferay DB?

Solution

  • Can you access it through the database? Yes. @Lakshmi (well, yourself) pointed to the place to watch out for.

    Should you do so? Absolutely not!

    Liferay's database is meant to be a black box for you. As soon as you think you understand it, you'll be tempted to write to the database and wonder why

    • search doesn't work any more
    • the next upgrade fails because of relationships to entities unknown to you
    • permission checks fail, because you didn't pay attention to them.

    There's an API, it's called Expando. And the linked answer to the other question has its details. Use that and don't bother with the database. Do yourself (and anybody maintaining your code later) a favor.

    Here's a more complete write-up of what you need in order to access the database. But you shouldn't need it - just leave it alone. Seriously.