[Hibernate-JIRA] Created: (EJB-337) Entity scaning failing when path protocol is "file:" (not jar) and it contains spaces
by valery gorbunov (JIRA)
Entity scaning failing when path protocol is "file:" (not jar) and it contains spaces
-------------------------------------------------------------------------------------
Key: EJB-337
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-337
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.3.1.GA
Environment: OS Linux
Hibernate 3.2.5ga
HiberanteEM -3.3.1ga
Reporter: valery gorbunov
Priority: Critical
Entity scanning failed when path contains spaces
Stack trace is:
java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
at org.jboss.util.file.JarArchiveBrowser.<init>(JarArchiveBrowser.java:74)
at org.jboss.util.file.FileProtocolArchiveBrowserFactory.create(FileProtocolArchiveBrowserFactory.java:48)
at org.jboss.util.file.FileProtocolArchiveBrowserFactoryTest.testCreate(FileProtocolArchiveBrowserFactoryTest.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.jar.JarFile.<init>(JarFile.java:133)
at java.util.jar.JarFile.<init>(JarFile.java:97)
at org.jboss.util.file.JarArchiveBrowser.<init>(JarArchiveBrowser.java:69)
... 24 more
Problem in FileProtocolArchiveBrowserFactory class
see test:
package org.jboss.util.file;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import junit.framework.Assert;
import org.junit.Test;
/**
*
* @author Valery Gorbunov <a href=mailto:vgorbunov@comodo.com.ua>vgorbunov(a)comodo.com.ua</a>
*/
public class FileProtocolArchiveBrowserFactoryTest {
@Test
public void testCreate() throws MalformedURLException, URISyntaxException {
URI uri = new URI("file:/tmp/Path%20with%20space");
File f = new File(uri);
if (!f.exists()) {
Assert.assertTrue(f.mkdir());
}
FileProtocolArchiveBrowserFactory factory = new FileProtocolArchiveBrowserFactory();
Object ab = factory.create(f.toURI().toURL(), null);
assertNotNull(ab);
assertTrue(ab instanceof DirectoryArchiveBrowser);
}
}
--
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
16 years, 5 months
[Hibernate-JIRA] Commented: (HBX-609) SchemaUpdate with two identical DBs
by Cedric Dandoy (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-609?page=co... ]
Cedric Dandoy commented on HBX-609:
-----------------------------------
I think this is related to HIBERNATE-105 and HHH-3350
https://jira.jboss.org/jira/browse/HIBERNATE-105
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3350
> SchemaUpdate with two identical DBs
> -----------------------------------
>
> Key: HBX-609
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-609
> Project: Hibernate Tools
> Issue Type: Bug
> Environment: Hibernate 3.1.2, Oracle9i 9.2.0.5
> Reporter: Maciej Wisniewski
> Priority: Minor
>
> I have two Oracle users (A and B) on the same Oracle instance and trying to use one Hibernate application with schemaupdate (like in HHH-735) that creates all tables at first with user A and next with user B. The second failed with:
> <hibernate.util.JDBCExceptionReporter] could not get table metadata: BOOKMARK [???] java.sql.SQLException: ORA-01031: insufficient privileges
>
> After an investigation I've found that the problem is that in constructor of class org.hibernate.tool.hbm2ddl.TableMetadata schema is always A (even when connecting to user B). This variable gets its value from resultset created by method getTables from interface DatabaseMetaData (it is called from Configuration.generateSchemaUpdateScript). Oracle's thin driver implements this as an SQL:
> SELECT NULL AS table_cat,
> o.owner AS table_schem,
> o.object_name AS table_name,
> o.object_type AS table_type,
> NULL AS remarks
> FROM all_objects o
> WHERE o.owner LIKE ? ESCAPE '/'
> AND o.object_name LIKE ? ESCAPE '/'
> AND o.object_type IN ('xxx', 'TABLE')
> ORDER BY table_type, table_schem, table_name
> where the first "?" is unfortunatelly "%". So that table_schem is always A, even when asking for a table that belongs to B.
> Later Hibernate uses this fetched schema name to pass it to method DatabaseMetaData.getIndexInfo and it fails because it does no have privillages to A's index info.
--
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
16 years, 5 months
[Hibernate-JIRA] Created: (HHH-2782) Component getType caches the type value
by Kiss Zoltán (JIRA)
Component getType caches the type value
---------------------------------------
Key: HHH-2782
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2782
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.5
Environment: all
Reporter: Kiss Zoltán
Component class caches the value of the type attribute:
public Type getType() throws MappingException {
// added this caching as I noticed that getType() is being called multiple times...
if ( type == null ) {
type = buildType();
}
return type;
}
This forbids the use of 'dynamic attributes'.
For eg. if you try to add new properties to an existing dynamic-component with the addProperty method, then the rebuild of the session factory will failed, because the Component property will be invalid during the validation (in the Component there will be a different column span value, then in the cached ComponentType).
There should be a method like this in the Component class:
public void rebuildType() {
type = buildType();
}
With the help of this the type could be rebuild if it is necessary.
--
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
16 years, 5 months
[Hibernate-JIRA] Created: (HHH-3865) org.hibernate.Query iterate() ignores query's setCacheMode setting
by Erel Magnus (JIRA)
org.hibernate.Query iterate() ignores query's setCacheMode setting
------------------------------------------------------------------
Key: HHH-3865
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3865
Project: Hibernate Core
Issue Type: Bug
Environment: Postgresql, core 3.3.1GA
Reporter: Erel Magnus
Priority: Critical
The code below allways takes data from cache even though it shouldn't.
org.hibernate.Query query = getSession().getNamedQuery("X");
query.setCacheMode(CacheMode.IGNORE);
return query.iterate();
After debugging for a bit, I found that what happens is that:
1. The query selects only the ID
2. next() method of iterator allways return proxy
3. Accessing the proxy loads the object, and does it according to the session settings and not the query settings. In the above example it will load it from the cache.
The documentation states:
Override the current session cache mode, just for this query.
So from my understanding this includes also iterators that are part of the query.
--
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
16 years, 5 months
[Hibernate-JIRA] Updated: (ANN-30) @OnDelete
by Lajos Gathy (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-30?page=com... ]
Lajos Gathy updated ANN-30:
---------------------------
Attachment: Collection.java.diff
I ran into this problem not so long ago and tried to find a solution/workaround. I found that when I add an @OnDelete(action = OnDeleteAction.CASCADE) annotation to a @ManyToMany annotated getter I get the following exception: "only inverse one-to-many associations may use on-delete="cascade": ..."
This comes from org.hibernate.mapping.Collection.validate(Mapping). I modified this part (diff attached, based on hibernate core 3.3.0.SP1 source code... sorry, not the latest one, but I used this version). It seems to work, at least it generates the "on delete cascade" postfixes for the foreign keys (I use PostgreSQLDialect).
I understand that this is not even a change in Hibernate Annotations project but in Core, and I am not able to verify my solution with test cases, since I am not quite familiar with the source base of Hibernate. I just thought that I post my solution, since it seemed to me that the feature itself is implemented already in Hibernate, I just adjusted the validation not to fail.
If you find my solution working, please consider to put it into an upcoming release. Thanks in advance.
> @OnDelete
> ---------
>
> Key: ANN-30
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-30
> Project: Hibernate Annotations
> Issue Type: Improvement
> Components: binder
> Affects Versions: 3.1beta3
> Reporter: Emmanuel Bernard
> Assignee: Emmanuel Bernard
> Priority: Trivial
> Attachments: Collection.java.diff
>
>
> @OnDelete(type=OnDeleteType.NOACTION)
> OnDeleteType.CASCADE
> used on an indexed collection
--
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
16 years, 5 months
[Hibernate-JIRA] Created: (HBX-1122) hql query level validation fails in createQuery("hql query") when "hql query" falls in more than one line
by radhakrishna (JIRA)
hql query level validation fails in createQuery("hql query") when "hql query" falls in more than one line
---------------------------------------------------------------------------------------------------------
Key: HBX-1122
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1122
Project: Hibernate Tools
Issue Type: Sub-task
Reporter: radhakrishna
Here is when it works and when it does not:
createQuery(''hql query") seems to be working ONLY as long as the hql query falls in the same line as in the following case, I am accessing an invalid field nonExistingField rather without a getter method from SomeObj class.
createQuery("from SomeObj someObj where someObj.nonExistingField is null"); // throws errors
createQuery("from SomeObj someObj where " +
"someObj.nonExistingField is null"); // DOES NOT throw errors
so when the query goes into the second line, which is true in most of the cases, it does not show errors.
The same issue applies when using the hql autocompleter while writing the query within the createQuery("hql query"), using ctrl + space, it helps only in the first line and does not in the subsequent lines.
I use Eclipse Europa and Ganymede with Hibernate Tools 3.2.3
Help please!
--
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
16 years, 5 months
[Hibernate-JIRA] Created: (HHH-3863) Exception when using "log4j.logger.org.hibernate.engine.QueryParameters=trace"
by Ioan LUPU (JIRA)
Exception when using "log4j.logger.org.hibernate.engine.QueryParameters=trace"
------------------------------------------------------------------------------
Key: HHH-3863
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3863
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: hibernate-distribution-3.3.1.GA
Reporter: Ioan LUPU
Caused by: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.String
at org.hibernate.type.MetaType.toXMLString(MetaType.java:115)
at org.hibernate.type.MetaType.toLoggableString(MetaType.java:110)
at org.hibernate.pretty.Printer.toString(Printer.java:99)
at org.hibernate.engine.QueryParameters.traceParameters(QueryParameters.java:300)
at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:276)
at org.hibernate.impl.StatelessSessionImpl.executeUpdate(StatelessSessionImpl.java:355)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:117)
...
log4j.logger.org.hibernate.engine.QueryParameters=trace
HQL:
query = session.createQuery("" //
+ "delete " + Device.class.getName() + " a" //
+ " where a.object.class=:paramObjectClass" //
+ " and a.object.id in (:paramObjectListId)" //
+ "" //
);
query.setParameter("paramObjectClass", Rack.class);
query.setParameterList("paramObjectListId", list);
query.executeUpdate();
Device.hbm.xml:
...
<!-- Associations -->
<any name="object" id-type="integer" meta-type="string">
...
<meta-value value="G" class="xxx.Rack" />
...
</any>
...
--
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
16 years, 5 months
[Hibernate-JIRA] Commented: (HBX-669) Code level HQL query validation
by radhakrishna (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-669?page=co... ]
radhakrishna commented on HBX-669:
----------------------------------
Here is when it works and when it does not:
createQuery(''hql query") seems to be working ONLY as long as the hql query falls in the same line as in the following case, I am accessing an invalid field nonExistingField rather without a getter method from SomeObj class.
createQuery("from SomeObj someObj where someObj.nonExistingField is null"); // throws errors
createQuery("from SomeObj someObj where " +
"someObj.nonExistingField is null"); // DOES NOT throw errors
so when the query goes into the second line, which is true in most of the cases, it does not show errors.
The same issue applies when using the hql autocompleter, using ctrl + space.
Help please!
> Code level HQL query validation
> -------------------------------
>
> Key: HBX-669
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-669
> Project: Hibernate Tools
> Issue Type: New Feature
> Components: eclipse
> Reporter: Emmanuel Bernard
> Fix For: 3.2beta9
>
>
> When an Hibernate configuration is provided, the IDE should be able to validate a given HQL query written in the code and in the XML files
> The code level warning would be a killer feature.
> Note that the hard part for the code is to "reckognize" a string as HQL query.
--
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
16 years, 5 months