dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #04287
Can we apply regex string into hypernate mapping ?
> This is Postgresql dialect.The key question for me is how do we make
> it database independent? Do we return a recordset from the
> organisationunit table, apply a regex with java.util.regex or can we
> just push it back to the DB? Both Postres, MySQL and H2 seem to
> support this (MySQL uses RLIKE or REGEXP and H2 uses LIKE while
> postgres uses ~ ) So, we could create a query and then just execute it
> directly on the DB. Otherwise, I am not sure how to do it directly
> with Hibernate. Perhaps it is easy, but I reviewed a few pages from
> Google, and there did not seem to be a clear answer.
>
>
Excuse me, everyone !
I wanna ask to you all like the subject. At the present, I really don't know
how to do this. But in my opinion, can we use regex if using to combine with
the FILTER in hibernate mapping?
If can, I would like to suggest that we should not use all regexes for each
persistent object (DE, Orgunit, Cate, ect...). Because if you apply all
regexes into hibernate mapping file you will accidentally make our system to
become rigid or inflexible (If you want to modify the regex which you want
so you MUST go to the hibernate file to re-fix and re-build your code) .
Although, this solution will help the system is faster in processing.
Btw, if using this way I don't know but I guess that your idea about using
the regex rule on each persistent object which is not available anymore.
Thus, I think we should combine them together.
We separate the regex rule to two kind of regex. One is regex default and
another one is customization (using by the user). Why called the second one
is customization? Because user can use or not the regex as they want
anytime.
> In the end however, the result set would then need to be returned to
> the user through during a data integrity check, with the list of
> fields that violate the rule, similar to what happens now.
>
>
Yeas, sure ! we have to show up what happening and which mistake to the user
when they are importing data into DHIS2.
> I think this is really incredibly important, and the example I have
> given thus far is really just a trivial example. I am sure there are
> many more situations where this would come in handy.
>
>
By the reason so you should thinking more my first opinion is above.
Thank you !
--
Hieu.HISPVietnam
Good Health !
--
Hieu.HISPVietnam
Good Health !
Follow ups