[Hibernate-JIRA] Created: (HHH-2998) ZoneAlarm DNS warning when AbstractUUIDGenerator is initialized on Windows Vista
by Moritz Gmelin (JIRA)
ZoneAlarm DNS warning when AbstractUUIDGenerator is initialized on Windows Vista
--------------------------------------------------------------------------------
Key: HHH-2998
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2998
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.5
Environment: Windows Vista with ZoneAlarm Firewall installed, Hibernate 3.2.5 and Java 1.6
Reporter: Moritz Gmelin
Priority: Minor
When Hibernate initializes the AbstractUUIDGenerator, a call to InetAddress.getLocalHost() is made to get the host's IP address. If the host running the application is a windows vista host with a Zone Alarm firewall installed, the user gets a popup window that the application is trying to a DNS lookup (the DNS lookup is not even executed).
This is not a hibernate bug. It is a vista & zone alarm bug. But it would be nice if the call in AbstractUUIDGenerator could be eliminated (the address is just used to generate some unique, random number). From looking at the code, I would guess that repacing the call by calling Math.random() would be just fine.
Thanks
Moritz
--
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
17 years, 1 month
[Hibernate-JIRA] Created: (HHH-2999) ZoneAlarm displaying a Warning when AbstractUUIDGenerator is initialized
by Moritz Gmelin (JIRA)
ZoneAlarm displaying a Warning when AbstractUUIDGenerator is initialized
------------------------------------------------------------------------
Key: HHH-2999
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2999
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.5
Environment: Windows Vista, Hibernate 3.2.5, Java 1.6, ZoneAlarm Firewall
Reporter: Moritz Gmelin
Priority: Minor
When Hibernate initializes the AbstractUUIDGenerator, a call to InetAddress.getLocalHost() is made to get the host's IP address. If the host running the application is a windows vista host with a Zone Alarm firewall installed, the user gets a popup window that the application is trying to a DNS lookup (the DNS lookup is not even executed).
This is not a hibernate bug. It is a vista & zone alarm bug. But it would be nice if the call in AbstractUUIDGenerator could be eliminated (the address is just used to generate some unique, random number). From looking at the code, I would guess that repacing the call by calling Math.random() would be just fine.
Thanks
Moritz
--
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
17 years, 1 month
[Hibernate-JIRA] Created: (HHH-2941) Criteria.createCriteria(associationPath) not works for Key-many-to-one
by Eddie Man (JIRA)
Criteria.createCriteria(associationPath) not works for Key-many-to-one
----------------------------------------------------------------------
Key: HHH-2941
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2941
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.4.sp1
Environment: Hibernate 3.2.4.sp1 + MySQL
Reporter: Eddie Man
Attachments: criteria_test.tar.gz
Suppose I had 2 class with the following content:
A.java
=================
public class A {
public A() {
}
public int ID;
public java.util.Set bs = new java.util.HashSet();
}
B.java
=================
import java.io.Serializable;
public class B implements Serializable {
public B() {
}
public int ID;
public A a;
}
A.hbm.xml
=================
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="A" table="A" lazy="false">
<id name="ID" column="ID" type="integer" unsaved-value="0" access="field">
<generator class="native">
</generator>
</id>
<set name="bs" lazy="true" cascade="save-update,lock" inverse="true" access="field">
<key column="AID" not-null="true"/>
<one-to-many class="B"/>
</set>
</class>
</hibernate-mapping>
B.hbm.xml
=================
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="B" table="B" lazy="false">
<composite-id>
<key-property name="ID" column="ID" type="integer" access="field"/>
<key-many-to-one name="a" column="AID" class="A" access="field">
</key-many-to-one>
</composite-id>
</class>
</hibernate-mapping>
Now, I want to find the B object with the specify B.ID and A.ID. Here is my code
Criteria criteria = session.createCriteria(B.class);
criteria.add(Expression.eq("ID", new Integer(2))); // B.ID = 2
criteria.createCriteria("a").add(Expression.eq("ID", new Integer(4))); // A.ID = 4
B b = (B) criteria.uniqueResult();
I turned on the show_sql in my configure file so that it will prompt all the sql statement in runtime, then executing the code, here is the printout:
09:35:59,096 WARN RootClass:211 - composite-id class does not override equals(): B
09:35:59,099 WARN RootClass:216 - composite-id class does not override hashCode(): B
Hibernate:
select
this_.ID as ID1_0_,
this_.AID as AID1_0_
from
B this_
where
this_.ID=?
and a1_.ID=?
09:35:59,982 WARN JDBCExceptionReporter:77 - SQL Error: 1054, SQLState: 42S22
09:35:59,982 ERROR JDBCExceptionReporter:78 - Unknown column 'a1_.ID' in 'where clause'
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1571)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305)
at ListTestData.main(ListTestData.java:17)
Caused by: java.sql.SQLException: Unknown column 'a1_.ID' in 'where clause'
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2921)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1570)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2978)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:930)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1024)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
... 7 more
It look like that the hibernate is missing the join table for the key-many-to-one. I had tested to using <key-property> and <many-to-one insert="false" update="false"> instread of <key-many-to-one>, and get no problem for that, so is it the bug on key many to one?
The schema and test case is attached.
Steps of reproduce the problem with the attached project:
=========
1. Execute the schema.ddl in to mysql db.
2. Execute java application "InsertTestData"
3. Record the last inserted id from the database and modify the "ListTestData" so that the expression value is correct.
4. Execute java application "ListTestData"
--
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
17 years, 1 month
[Hibernate-JIRA] Commented: (EJB-178) JarVisitor.getVisitor does not treat correctly paths with spaces
by Lars Francke (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/EJB-178?page=co... ]
Lars Francke commented on EJB-178:
----------------------------------
Yes, I know :)
And I'm using 3.3.1.ga and still get the same exception.
But now I'm not sure if this is the correct report or one of the other duplicates. I'll try to look at this when I get some time.
> JarVisitor.getVisitor does not treat correctly paths with spaces
> ----------------------------------------------------------------
>
> Key: EJB-178
> URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-178
> Project: Hibernate Entity Manager
> Issue Type: Bug
> Components: EntityManager
> Affects Versions: 3.1.0.Beta8
> Environment: Windows XP Professional; Tomcat 5.5.17.
> Reporter: Alexandrino Lucas
> Original Estimate: 15 minutes
> Remaining Estimate: 15 minutes
>
> I'm using Hibernate Entity Manager with a WAR deployed on Tomcat 5.5.17, and I'm getting the following error:
> 11/05/2006 16:12:43 org.hibernate.ejb.packaging.FileZippedJarVisitor doProcessElements
> WARNING: Unable to find file (ignored): file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps/[REST OMITTED]
> java.util.zip.ZipException: Access is denied
> at java.util.zip.ZipFile.open(Native Method)
> at java.util.zip.ZipFile.<init>(Unknown Source)
> at java.util.jar.JarFile.<init>(Unknown Source)
> at java.util.jar.JarFile.<init>(Unknown Source)
> at org.hibernate.ejb.packaging.FileZippedJarVisitor.doProcessElements(FileZippedJarVisitor.java:34)
> at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:208)
> at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:201)
> at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:183)
> at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
> at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
> [MORE...]
> Two strange things: 1) the directory exists; 2) Hibernate is treating the path as being part of a JAR file. I found the cause of the problem when analysing org.hibernate.ejb.packaging.JarVisitor.getVisitor(URL, Filter[]):
> File file = new File( jarUrl.getFile() );
> if ( file.isDirectory() ) {
> return new ExplodedJarVisitor( jarUrl, filters );
> }
> else {
> return new FileZippedJarVisitor( jarUrl, filters );
> }
> As my path has some spaces, jarUrl.getFile() returns "/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps/[REST OMITTED]", which is not a directory, because of the "%20"'s. The specification of the java.net.URL class says: "The URL class does not itself encode or decode any URL components according to the escaping mechanism defined in RFC2396. It is the responsibility of the caller to encode any fields, which need to be escaped prior to calling URL, and also to decode any escaped fields, that are returned from URL."
> Although I did not have the time to build the project with it, I think that jarUrl.toURI().getPath() would solve the problem. Here is a snippet to prove it:
> import java.io.File;
> import java.net.URL;
> public class Main
> {
> public static void main(
> String[] args )
> throws Exception
> {
> URL url = new URL(
> "file:///C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/webapps" );
> System.out.println( "url.getFile()" );
> System.out.println( url.getFile() );
> System.out.println( new File( url.getFile() ).isDirectory() );
> System.out.println();
> System.out.println();
> System.out.println();
> System.out.println( "url.toURI().getPath()" );
> System.out.println( url.toURI().getPath() );
> System.out.println( new File( url.toURI().getPath() ).isDirectory() );
> }
> }
--
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
17 years, 1 month