[Hibernate-JIRA] Created: (HHH-3731) ConstraintViolationException logged at level ERROR instead of WARN or INFO
by Jonathan Amir (JIRA)
ConstraintViolationException logged at level ERROR instead of WARN or INFO
--------------------------------------------------------------------------
Key: HHH-3731
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3731
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.6
Environment: hibernate core jar specifies 3.2.6 in META-INF folder. database is oracle 10.2. OS is Win XP
Reporter: Jonathan Amir
Priority: Minor
Attachments: stacktrace.txt
Please see this thread for an example and an explanation of the problem:
http://forums.hibernate.org/viewtopic.php?p=2258025&sid=cdcf98f3e9026fad9...
Basically, it is a valid use-case for a developer to insert a record to the db and to try and catch a ConstraintViolationException. Upon catching it, it should be the developer's choice regarding what to do, how to recover, etc., and also how to log it.
However, Hibernate logs the error before throwing it, and at log level ERROR, no less, thus polluting the log files with superfluous messages. It is not practical to log messages at this Level. The offending class is AbstractFlushingEventListener.java (I'm attaching a stacktrace to illustrate).
Please reduce the log level of this message to WARN or INFO.
There's also a sort of philosophical argument for this request. Some may argue, like in the reply in the linked thread above, that a constraint violation is an error, thus it should be logged as one. However, that is an application-domain error, not a hibernate error. Hibernate is a library, and as such it should conform to user's requirements. First, it should use the ERROR level only to log real errors related to Hibernate's functionality as a library. Secondly, it should aim to give the user maximum flexiblity and control with regards to logging.
(Not withstanding the previous statement, logging application problems is, of course, very helpful for debugging, but it should be at a lower log level)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 9 months
[Hibernate-JIRA] Closed: (HHH-272) Add the ablity to use sql functions on generated insert/update
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-272?page=co... ]
Steve Ebersole closed HHH-272.
------------------------------
Resolution: Incomplete
See HHH-4440
> Add the ablity to use sql functions on generated insert/update
> --------------------------------------------------------------
>
> Key: HHH-272
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-272
> Project: Hibernate Core
> Issue Type: New Feature
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate3, Oracle9
> Reporter: Joe Dunne
> Assignee: Steve Ebersole
> Priority: Minor
> Attachments: AbstractCollectionPersister.java, BasicEntityPersister.java, Column.java, HbmBinder.java, hhh-272-hbcore-patch.txt, hhh-272-hbcore-trunk-patch.txt, hhh-272-hbcoredoc-trunk-patch.txt, hibernate-mapping-3.0.dtd, Insert.java, SelectFragment.java, Update.java
>
>
> I would like to have Hibernate generate insert and update statements that contain a stored proc call.
> For example:
> insert into cat (id, name, tag) values ( ?, ? , encrypt(?) )
> Currently I have implemented the following:
> maping file:
> <property name="ssn" type="java.lang.String" access="field">
> <column name="SSN" scale="128" precision="0" not-null="false" sql-type="VARCHAR2" />
> </property>
> <property name="ssnDecrypted" formula="FNC_JAVA_DECRYPT(SSN)" type="java.lang.String" access="field"/>
> <sql-insert>insert into PARTICIPANT (VERSION, DATE_MODIFIED, DATE_CREATED, MODIFIED_BY, CREATED_BY, FIRST_NAME, LAST_NAME, PASSWORD, USERNAME, SSN, EMAIL, ID)
> values (?, ?, ?, ?, ?, ?, ?, ?, ?, FNC_JAVA_ENCRYPT(?), ?, ?)</sql-insert>
> <sql-update>update PARTICIPANT set VERSION=?, DATE_MODIFIED=?, DATE_CREATED=?, MODIFIED_BY=?, CREATED_BY=?, FIRST_NAME=?, LAST_NAME=?,
> PASSWORD=?, USERNAME=?, SSN = FNC_JAVA_ENCRYPT(?), EMAIL=? where ID=? and VERSION=?</sql-update>
> Domain Object:
> public String getSsn() {
> return ssnDecrypted;
> }
> public void setSsn(String ssn) {
> this.ssn = ssn;
> this.ssnDecrypted = ssn;
> }
> This works, but I would like to avoid the <sql-insert> and <sql-update> tags since the project I am on has multiple customer deployments. Each customer can specify what fields they want encrypted. It would be much easier to not have the deployment team write the sql for insert and update for each customer.
> Also, Java encryption is out. We have to do it in the database.
> The EnhancedUserType could support this - perhaps.
> public String getUpdateFragment() {
> return "encrypt(?)";
> }
> public String getInsertFragment() {
> return "encrypt(?)";
> }
> //Is this one possible too? This would avoid the double mapping
> //above and the magic in the domain object
> public String getSelectFragment(String columnName) {
> return "decrypt("+columnName+")";
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 9 months
[Hibernate-JIRA] Commented: (HHH-4382) @ManyToOne not working wth @Formula
by Ravi Hasija (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4382?page=c... ]
Ravi Hasija commented on HHH-4382:
----------------------------------
I just voted for this issue. I am not sure if there is any traction on this. With the legacy database that I am working with, lack of this feature is driving me to use hbm's instead of annotations. I love annotations and would really appreciate if I could use it for my current scenario. Is this feature in the road map? Just curious.
Many thanks for the work you guys have been putting forth!!! Much appreciated!!
> @ManyToOne not working wth @Formula
> -----------------------------------
>
> Key: HHH-4382
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4382
> Project: Hibernate Core
> Issue Type: Improvement
> Components: annotations
> Environment: Hibernate 3.1, PostgreSQL 8.1.1
> Reporter: Steve Ebersole
>
> This type of mapping fails:
> @ManyToOne
> @Formula(value="( select v_pipe_offerprice.offerprice_fk from v_pipe_offerprice where v_pipe_offerprice.id = id )")
> public OfferPrice getOfferPrice() { return offerPrice; }
> While the following mapping works as expected:
> <class name="Pipe" table="t_pipe">
> ...
> <many-to-one name="offerPrice"
> class="pipetracker.model.price.OfferPrice"
> formula="( select v_pipe_offerprice.offerprice_fk
> from v_pipe_offerprice
> where v_pipe_offerprice.id = id )"/>
> ...
> </class>
> This is not being treated as a formula because the generated SQL included a referece to the field pipe.offerprice_id which does not exsist because this is a virtual column calculated from a view.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 9 months
[Hibernate-JIRA] Updated: (HHH-272) Add the ablity to use sql functions on generated insert/update
by Rob Hasselbaum (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-272?page=co... ]
Rob Hasselbaum updated HHH-272:
-------------------------------
Attachment: hhh-272-hbcoredoc-trunk-patch.txt
Attached "hhh-272-hbcoredoc-trunk-patch.txt" file containing proposed documentation changes.
> Add the ablity to use sql functions on generated insert/update
> --------------------------------------------------------------
>
> Key: HHH-272
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-272
> Project: Hibernate Core
> Issue Type: New Feature
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate3, Oracle9
> Reporter: Joe Dunne
> Assignee: Steve Ebersole
> Priority: Minor
> Attachments: AbstractCollectionPersister.java, BasicEntityPersister.java, Column.java, HbmBinder.java, hhh-272-hbcore-patch.txt, hhh-272-hbcore-trunk-patch.txt, hhh-272-hbcoredoc-trunk-patch.txt, hibernate-mapping-3.0.dtd, Insert.java, SelectFragment.java, Update.java
>
>
> I would like to have Hibernate generate insert and update statements that contain a stored proc call.
> For example:
> insert into cat (id, name, tag) values ( ?, ? , encrypt(?) )
> Currently I have implemented the following:
> maping file:
> <property name="ssn" type="java.lang.String" access="field">
> <column name="SSN" scale="128" precision="0" not-null="false" sql-type="VARCHAR2" />
> </property>
> <property name="ssnDecrypted" formula="FNC_JAVA_DECRYPT(SSN)" type="java.lang.String" access="field"/>
> <sql-insert>insert into PARTICIPANT (VERSION, DATE_MODIFIED, DATE_CREATED, MODIFIED_BY, CREATED_BY, FIRST_NAME, LAST_NAME, PASSWORD, USERNAME, SSN, EMAIL, ID)
> values (?, ?, ?, ?, ?, ?, ?, ?, ?, FNC_JAVA_ENCRYPT(?), ?, ?)</sql-insert>
> <sql-update>update PARTICIPANT set VERSION=?, DATE_MODIFIED=?, DATE_CREATED=?, MODIFIED_BY=?, CREATED_BY=?, FIRST_NAME=?, LAST_NAME=?,
> PASSWORD=?, USERNAME=?, SSN = FNC_JAVA_ENCRYPT(?), EMAIL=? where ID=? and VERSION=?</sql-update>
> Domain Object:
> public String getSsn() {
> return ssnDecrypted;
> }
> public void setSsn(String ssn) {
> this.ssn = ssn;
> this.ssnDecrypted = ssn;
> }
> This works, but I would like to avoid the <sql-insert> and <sql-update> tags since the project I am on has multiple customer deployments. Each customer can specify what fields they want encrypted. It would be much easier to not have the deployment team write the sql for insert and update for each customer.
> Also, Java encryption is out. We have to do it in the database.
> The EnhancedUserType could support this - perhaps.
> public String getUpdateFragment() {
> return "encrypt(?)";
> }
> public String getInsertFragment() {
> return "encrypt(?)";
> }
> //Is this one possible too? This would avoid the double mapping
> //above and the magic in the domain object
> public String getSelectFragment(String columnName) {
> return "decrypt("+columnName+")";
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 9 months
[Hibernate-JIRA] Updated: (HHH-272) Add the ablity to use sql functions on generated insert/update
by Rob Hasselbaum (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-272?page=co... ]
Rob Hasselbaum updated HHH-272:
-------------------------------
Attachment: hhh-272-hbcore-trunk-patch.txt
Attaching new patch "hhh-272-hbcore-trunk-patch.txt" based on Steve's review. The patch contains the following changes:
(1) Based on code in trunk.
(2) Renamed "sql-get" and "sql-set" to "read" and "write".
(3) Reverted unnecessary interface change in Selectable.
(4) Restored public methods in Update and Delete classes.
> Add the ablity to use sql functions on generated insert/update
> --------------------------------------------------------------
>
> Key: HHH-272
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-272
> Project: Hibernate Core
> Issue Type: New Feature
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate3, Oracle9
> Reporter: Joe Dunne
> Assignee: Steve Ebersole
> Priority: Minor
> Attachments: AbstractCollectionPersister.java, BasicEntityPersister.java, Column.java, HbmBinder.java, hhh-272-hbcore-patch.txt, hhh-272-hbcore-trunk-patch.txt, hibernate-mapping-3.0.dtd, Insert.java, SelectFragment.java, Update.java
>
>
> I would like to have Hibernate generate insert and update statements that contain a stored proc call.
> For example:
> insert into cat (id, name, tag) values ( ?, ? , encrypt(?) )
> Currently I have implemented the following:
> maping file:
> <property name="ssn" type="java.lang.String" access="field">
> <column name="SSN" scale="128" precision="0" not-null="false" sql-type="VARCHAR2" />
> </property>
> <property name="ssnDecrypted" formula="FNC_JAVA_DECRYPT(SSN)" type="java.lang.String" access="field"/>
> <sql-insert>insert into PARTICIPANT (VERSION, DATE_MODIFIED, DATE_CREATED, MODIFIED_BY, CREATED_BY, FIRST_NAME, LAST_NAME, PASSWORD, USERNAME, SSN, EMAIL, ID)
> values (?, ?, ?, ?, ?, ?, ?, ?, ?, FNC_JAVA_ENCRYPT(?), ?, ?)</sql-insert>
> <sql-update>update PARTICIPANT set VERSION=?, DATE_MODIFIED=?, DATE_CREATED=?, MODIFIED_BY=?, CREATED_BY=?, FIRST_NAME=?, LAST_NAME=?,
> PASSWORD=?, USERNAME=?, SSN = FNC_JAVA_ENCRYPT(?), EMAIL=? where ID=? and VERSION=?</sql-update>
> Domain Object:
> public String getSsn() {
> return ssnDecrypted;
> }
> public void setSsn(String ssn) {
> this.ssn = ssn;
> this.ssnDecrypted = ssn;
> }
> This works, but I would like to avoid the <sql-insert> and <sql-update> tags since the project I am on has multiple customer deployments. Each customer can specify what fields they want encrypted. It would be much easier to not have the deployment team write the sql for insert and update for each customer.
> Also, Java encryption is out. We have to do it in the database.
> The EnhancedUserType could support this - perhaps.
> public String getUpdateFragment() {
> return "encrypt(?)";
> }
> public String getInsertFragment() {
> return "encrypt(?)";
> }
> //Is this one possible too? This would avoid the double mapping
> //above and the magic in the domain object
> public String getSelectFragment(String columnName) {
> return "decrypt("+columnName+")";
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 9 months