[Hibernate-JIRA] Created: (HHH-2019) Provide a way to unset properties, and/or provide a 'none' option for hbm2ddl.auto
by Dave E Martin (JIRA)
Provide a way to unset properties, and/or provide a 'none' option for hbm2ddl.auto
----------------------------------------------------------------------------------
Key: HHH-2019
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2019
Project: Hibernate3
Type: Improvement
Environment: hibernate / annotations / hibernate.properties
Reporter: Dave E Martin
Priority: Minor
It may occasionally be desirable to programmatically get rid of or override a property value, this is generally allowed for by the .setProperty method, however:
Once hbm2ddl.auto is set to something, there is no way to unset it, or set it to a value which would be equivalent to its being unset (or its undocumented). There is no remove or unset, or deleteProperty, and also setting it to null does not work.
Due to issues such as HHH-2018, it may be necessary to programmatically 'get rid of' hbm2ddl.auto even if the end user (or some other mechanism) has specified a value for it in an external hibernate.properties file (or other method of setting hibernate properties).
--
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
18 years, 6 months
[Hibernate-JIRA] Commented: (HHH-817) using projections is causing SQL query error on oracle (ORA-00904 error)
by Bryan Stopp (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-817?page=co... ]
Bryan Stopp commented on HHH-817:
---------------------------------
I would like to add that DB2 doesn't support it either.
Also, a note on the workaround. You should only prefix the alias for those columns that are associated with the main table in the query. I found that when adding a prefix to a child table along an association path, an exception was thrown stating that it could not find the associated property.
Removing the alias on child table elements allowed me to prevent the use of the alias in the WHERE clause, as well as properly utilize a ResultTransformer.
My 2 cents.
-B
> using projections is causing SQL query error on oracle (ORA-00904 error)
> ------------------------------------------------------------------------
>
> Key: HHH-817
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-817
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.0.5
> Environment: Oracle 9.2.0.6, Hibernate 3.0.5, Spring Framework 1.2.2 based application working on Jakarta Tomcat 5.0.28
> Reporter: Michal Jastak
> Priority: Minor
> Attachments: HHH-817.patch
>
>
> following java code:
> protected Entity loadEntityLightweight(Serializable entityId) throws DataAccessException {
> Criteria criteria = getSession().createCriteria(Entity.class);
> ProjectionList projectionList = Projections.projectionList();
> projectionList.add(Property.forName(BaseEntity.PROP_ID), BaseEntity.PROP_ID);
> projectionList.add(Property.forName(BaseEntity.PROP_TYPE), BaseEntity.PROP_TYPE);
> criteria.setProjection(projectionList);
> criteria.add(Restrictions.eq(BaseEntity.PROP_ID, entityId));
> criteria.setResultTransformer(new AliasToBeanResultTransformer(Entity.class));
> return (Entity) criteria.uniqueResult();
> }
> generates following SQL query:
> select this_.id as y0_, this_.type as y1_ from entities this_ left outer join facilities this_1_ on this_.id=this_1_.id left outer join users this_2_ on this_.id=this_2_.id left outer join addresses address2_ on this_.address_id=address2_.id left outer join entities entity3_ on this_2_.employer_id=entity3_.id left outer join facilities entity3_1_ on entity3_.id=entity3_1_.id left outer join users entity3_2_ on entity3_.id=entity3_2_.id where y0_=?
> y0_ = ? expression in where clause is causing a 904 error on Oracle 9:
> ORA-00904: "Y0_": invalid identifier
> hibernate dialect: org.hibernate.dialect.Oracle9Dialect
> mapping for Entity class:
> <?xml version="1.0"?>
> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
> "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
> <hibernate-mapping default-lazy="false" default-cascade="save-update">
>
> <class name="Entity" table="entities" mutable="true">
> <id name="id" type="java.lang.Long" unsaved-value="null">
> <generator class="sequence">
> <param name="sequence">entities_id_seq</param>
> </generator>
> </id>
> <many-to-one name="address" class="Address" column="address_id" />
> ...
> <!--
> - Facilities
> -->
> <joined-subclass name="Facility" table="facilities">
> <key column="id" />
> ...
> <set name="users" inverse="true" lazy="true">
> <key column="facility_id" />
> <one-to-many class="User" />
> </set>
> </joined-subclass>
> <!--
> - Users
> -->
> <joined-subclass name="User" table="users" dynamic-insert="true" dynamic-update="true">
> <key column="id" />
> <many-to-one name="employer" class="Entity" column="employer_id" cascade="none" />
> ...
> <set name="userAuthorities" inverse="true" cascade="all-delete-orphan">
> <key column="user_id" />
> <one-to-many class="Authority" />
> </set>
> </joined-subclass>
> </class>
> </hibernate-mapping>
--
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
18 years, 6 months
[Hibernate-JIRA] Created: (HBX-865) ClassValidator cannot be instantiated while trying to open a new Session
by Christian Laakmann (JIRA)
ClassValidator cannot be instantiated while trying to open a new Session
------------------------------------------------------------------------
Key: HBX-865
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-865
Project: Hibernate Tools
Type: Bug
Versions: 3.2beta9
Environment: Hibernate 3.2, Hibernate Tools 3.2beta9 and most recent Nightly
DB: MSSQL Server 2000 & HSQLDB
Reporter: Christian Laakmann
Attachments: Test.java, hibernate.cfg.xml
When I use the @NotEmpty Validator on a String property, Hibernate Tools is unable to open a new Session because the ClassValidator could not be instantiated.
Workaround was to replace @NotEmpty with @NotNull.
see also: http://forum.hibernate.org/viewtopic.php?p=2339708#2339708
Stack-Trace:
java.lang.IllegalArgumentException: could not instantiate ClassValidator
at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:287)
at org.hibernate.validator.ClassValidator.createMemberValidator(ClassValidator.java:255)
at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:216)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:127)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:105)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:97)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:319)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1210)
at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:317)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:89)
at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:312)
at org.hibernate.eclipse.console.workbench.LazySessionFactoryAdapter.getChildren(LazySessionFactoryAdapter.java:41)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:88)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:94)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:207)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Caused by: java.util.MissingResourceException: Can't find resource in validator bundles, key validator.notEmpty
at org.hibernate.validator.interpolator.DefaultMessageInterpolator.replace(DefaultMessageInterpolator.java:107)
at org.hibernate.validator.interpolator.DefaultMessageInterpolator.initialize(DefaultMessageInterpolator.java:66)
at org.hibernate.validator.interpolator.DefaultMessageInterpolatorAggerator.addInterpolator(DefaultMessageInterpolatorAggerator.java:37)
at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:283)
... 16 more
java.util.MissingResourceException: Can't find resource in validator bundles, key validator.notEmpty
at org.hibernate.validator.interpolator.DefaultMessageInterpolator.replace(DefaultMessageInterpolator.java:107)
at org.hibernate.validator.interpolator.DefaultMessageInterpolator.initialize(DefaultMessageInterpolator.java:66)
at org.hibernate.validator.interpolator.DefaultMessageInterpolatorAggerator.addInterpolator(DefaultMessageInterpolatorAggerator.java:37)
at org.hibernate.validator.ClassValidator.createValidator(ClassValidator.java:283)
at org.hibernate.validator.ClassValidator.createMemberValidator(ClassValidator.java:255)
at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:216)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:127)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:105)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:97)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:319)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1210)
at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:317)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:89)
at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:312)
at org.hibernate.eclipse.console.workbench.LazySessionFactoryAdapter.getChildren(LazySessionFactoryAdapter.java:41)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:88)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:94)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:207)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
--
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
18 years, 6 months
[Hibernate-JIRA] Closed: (HBX-267) hbm2java does not handle <properties> tag correctly
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-267?page=co... ]
Max Rydahl Andersen closed HBX-267.
-----------------------------------
Resolution: Fixed
about time we got this one fixed .... committed to svn (with more tests, but otherwise the same)
p.s. use unified diff in the future - thanks ;)
> hbm2java does not handle <properties> tag correctly
> ---------------------------------------------------
>
> Key: HBX-267
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-267
> Project: Hibernate Tools
> Issue Type: Patch
> Components: hbm2java
> Affects Versions: 3.0alpha
> Environment: Hibernate Tools from CVS
> Reporter: Jason Boutwell
> Fix For: 3.2beta10
>
> Attachments: failingtest.zip, patch.txt, patch.txt, PropertiesUsage.java
>
>
> If an hbm <class> mapping contains a <properties> tag, hbm2java creates a POJO that contains only the child properties of the <properties> logical element. All other elements in the class mapping are discarded. I've looked at the source code, and, while not intimate with it, I speculate that hbm2java is treating <properties> like <component> and overwriting the actual entity POJO with a component POJO. Is this a bug, or is the <properties> tag explicitly not yet supported?
--
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
18 years, 6 months