FW: [Hibernate] Lazy Collections

2002-12-04 Thread Aapo Laakkonen
> I had a *really* close look into the possibility
> that Hibernate issues the unclosed session WARNing
> when the session has in fact been closed and I've
> concluded that it doesn't. I am quite certain that
> the problem is that the user is not closing the
> sessions. (In a couple of previous complaints about
> this, that turned out to be the case.)

Ok it might be my fault (and probably is). Do you see any strange in
this:

Background:

- I have extended Maveric Dispatcher so that it loads Hibernate Session
Factory from JNDI and places it in servlet context. Is that proper thing
to do?
- I have abstract controller that every of my maverick commands extends.
- Abstract controller has 2 methods. getSession() that loads Session
factory from Servlet context and then opens a new session (if user has
already called this.getSession, then it returns previously opened
session) and places it in class level variable and then returns it to
user.
- User then uses session.
- User does not close session.
- Session is closed in Abstract controller's discard() method that
maverick calls automatically after it has served the client (e.g. gui is
generated).

The proces goes like this:

1. User makes request eg. grid.m that is a maveric command.
2. Maverick initializes NEW controller (the controller extends abstract
controller) 3. Then maverick calls execute method. 4. execute method
calls this.getSession.find("whatever") <- lazy collection 5. execute
method returns a string (that is the view to be rended) 6. Maverick
generates a view (view uses lazy collection) 7. Maverick calls discard
(that closes a session)

The generated HTML (in this case) contains many img tags like this



So every needed image gets loaded throught Maverick from database.
image.m command opens session as above and after sending raw data with
proper content-type session get's closed in execute method (Maveric
calls discard, but it doesn't do anything cause session is already
closed by execute command).

The problem is that I have no idea why Hibernate's SessionImpl finalize
method tries to close connections that I have already closed (I can
output proper log messages when discard is called). What I have found is
that if I don't close connections in execute method (prior view), then I
sometimes leaves connections open. At least on load testing. If I don't
use lazy collections I do not have this problem.

> As to the use of finally, cleanup code that *must*
> be executed is *exactly* the role of the finally
> block, as per any Java textbook. And it is
> completely predictable. Method exit cannot occur
> without execution of the finally block. Are you
> sure the redbook wasn't talking about finalize(),
> which *is* unreliable?

It's quite long time when I read that, and I could have read it wrong (I
checked IBM docs and they all used finally)... and if I think about it,
I agree with you. The errors I get about unclosed connections, I get
them from SessionImpl finalize(). But problem is not there I think.

Is it proper to place SessionFactory in servlet context, or should I
always retrieve it from JNDI? I think that JNDI lookup causes some
overhead, so I have put the Session factory in servlet context.

When I should use Session.disconnect / reconnect instead open and close?

Should I set session to null and should I also check if session.close
returns an open connection? Do I need to close the connection then
manually? Do i need to set connection = null?

Kind Regards
Aapo ungle Laakkonen



---
This SF.net email is sponsored by: Microsoft Visual Studio.NET 
comprehensive development tool, built to increase your 
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



RE: [Hibernate] Lazy Collections

2002-12-04 Thread Gavin King
Where are connections coming from? A Hibernate ConnectionProvider? Or an
application supplied connection?

What guarantees does Maverick make about when / wether discard() will be
called? Is it *guaranteed* to be called in the case of an exception,
etc?

> -Original Message-
> From: Aapo Laakkonen [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, 5 December 2002 12:35 AM
> To: [EMAIL PROTECTED]
> Subject: FW: [Hibernate] Lazy Collections
> 
> 
> > I had a *really* close look into the possibility
> > that Hibernate issues the unclosed session WARNing
> > when the session has in fact been closed and I've
> > concluded that it doesn't. I am quite certain that
> > the problem is that the user is not closing the
> > sessions. (In a couple of previous complaints about
> > this, that turned out to be the case.)
> 
> Ok it might be my fault (and probably is). Do you see any strange in
> this:
> 
> Background:
> 
> - I have extended Maveric Dispatcher so that it loads 
> Hibernate Session Factory from JNDI and places it in servlet 
> context. Is that proper thing to do?
> - I have abstract controller that every of my maverick 
> commands extends.
> - Abstract controller has 2 methods. getSession() that loads 
> Session factory from Servlet context and then opens a new 
> session (if user has already called this.getSession, then it 
> returns previously opened
> session) and places it in class level variable and then 
> returns it to user.
> - User then uses session.
> - User does not close session.
> - Session is closed in Abstract controller's discard() method 
> that maverick calls automatically after it has served the 
> client (e.g. gui is generated).
> 
> The proces goes like this:
> 
> 1. User makes request eg. grid.m that is a maveric command.
> 2. Maverick initializes NEW controller (the controller 
> extends abstract
> controller) 3. Then maverick calls execute method. 4. execute 
> method calls this.getSession.find("whatever") <- lazy 
> collection 5. execute method returns a string (that is the 
> view to be rended) 6. Maverick generates a view (view uses 
> lazy collection) 7. Maverick calls discard (that closes a session)
> 
> The generated HTML (in this case) contains many img tags like this
> 
> 
> 
> So every needed image gets loaded throught Maverick from 
> database. image.m command opens session as above and after 
> sending raw data with proper content-type session get's 
> closed in execute method (Maveric calls discard, but it 
> doesn't do anything cause session is already closed by 
> execute command).
> 
> The problem is that I have no idea why Hibernate's 
> SessionImpl finalize method tries to close connections that I 
> have already closed (I can output proper log messages when 
> discard is called). What I have found is that if I don't 
> close connections in execute method (prior view), then I 
> sometimes leaves connections open. At least on load testing. 
> If I don't use lazy collections I do not have this problem.
> 
> > As to the use of finally, cleanup code that *must*
> > be executed is *exactly* the role of the finally
> > block, as per any Java textbook. And it is
> > completely predictable. Method exit cannot occur
> > without execution of the finally block. Are you
> > sure the redbook wasn't talking about finalize(),
> > which *is* unreliable?
> 
> It's quite long time when I read that, and I could have read 
> it wrong (I checked IBM docs and they all used finally)... 
> and if I think about it, I agree with you. The errors I get 
> about unclosed connections, I get them from SessionImpl 
> finalize(). But problem is not there I think.
> 
> Is it proper to place SessionFactory in servlet context, or 
> should I always retrieve it from JNDI? I think that JNDI 
> lookup causes some overhead, so I have put the Session 
> factory in servlet context.
> 
> When I should use Session.disconnect / reconnect instead open 
> and close?
> 
> Should I set session to null and should I also check if 
> session.close returns an open connection? Do I need to close 
> the connection then manually? Do i need to set connection = null?
> 
> Kind Regards
> Aapo ungle Laakkonen
> 
> 
> 
> ---
> This SF.net email is sponsored by: Microsoft Visual Studio.NET 
> comprehensive development tool, built to increase your 
> productivity. Try a free online hosted session at: 
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
___
hibernate-devel mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


** CAUTION - Disclaimer **
This message may contain privileged and confidential
information. If you are not the intended recipient of this
message (or responsible for delivery of the message to
such person) you are hereby notified that any use,
dissemination, distribution or reproduction of this message
is prohibited. If you have received this message

FW: [Hibernate] Lazy Collections

2002-12-04 Thread Aapo Laakkonen
> Where are connections coming from? A Hibernate ConnectionProvider? Or 
> an application supplied connection?

They come from JNDI and I use Hibernate XML configuration and initialize
Hibernate with configure();.

> What guarantees does Maverick make about when /
> wether discard() will be called? Is it *guaranteed*
> to be called in the case of an exception, etc?

Great questions, :-).

Thanks! Now I'm trying to get Transactions to use JTA. The problem is
that I get following warnings:

04:18:56,649 WARN
[JTATransactionFactory] No TransactionManagerLookup configured
(use of JCS read-write cache is not recommended)

What is this setting. I get that warning even if I don't use JCS. 

This is my hibernate.properties:

hibernate.use_outer_join=true
hibernate.show_sql=false
hibernate.jdbc.batch_size=10
hibernate.statement_cache.size=20
hibernate.transaction.factory_class=cirrus.hibernate.transaction.JTATran
sactionFactory
hibernate.transaction.manager_class=cirrus.hibernate.transaction.JNDITra
nsactionManagerLookup
hibernate.query.substitutions yes 'Y', no 'N'
jta.UserTransaction=java:comp/UserTransaction

And here is Hibernate.cfg.xml:

http://hibernate.sourceforge.net/hibernate-co




java:comp/env/jdbc/xa/postgresql/something<
/property>
cirrus.hibernate.sql.PostgreSQLDialect

... mapping files ...





Another warning I get with Resin is:

04:18:57,258 WARN
[SessionFactoryObjectFactory] InitialContext did not implement
EventContext

Should I care about it?



---
This SF.net email is sponsored by: Microsoft Visual Studio.NET 
comprehensive development tool, built to increase your 
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



RE: [Hibernate] Lazy Collections

2002-12-04 Thread Aapo Laakkonen
> 04:18:56,649 WARN
> [JTATransactionFactory] No TransactionManagerLookup configured
> (use of JCS read-write cache is not
recommended)

Ok there is error in documentation (it's not
hibernate.transaction.manager_class).

This works:
hibernate.transaction.manager_lookup_class=cirrus.hibernate.transaction.
ResinTransactionManagerLookup


Now it works fine! Great work! Definately the best O/R tool.


--- code ---

Here is code for ResinTransactionManagerLookup class:

package cirrus.hibernate.transaction;

public final class ResinTransactionManagerLookup extends
JNDITransactionManagerLookup {

/**
 * @see
cirrus.hibernate.transaction.JNDITransactionManagerLookup#getName()
 */
protected String getName() {
return "java:comp/TransactionManager";
}

}

--- code ---


ResinTransactionManagerLookup.java
Description: Binary data


RE: [Hibernate] Lazy Collections

2002-12-04 Thread Gavin King

Comments inline

> 04:18:56,649 WARN
> [JTATransactionFactory] No TransactionManagerLookup configured
> (use of JCS read-write cache is not 
> recommended)
> 
> What is this setting. I get that warning even if I don't use JCS. 
> 
> This is my hibernate.properties:
> 
> hibernate.use_outer_join=true
> hibernate.show_sql=false
> hibernate.jdbc.batch_size=10
> hibernate.statement_cache.size=20 
> hibernate.transaction.factory_class=cirrus.hibernate.transacti
> on.JTATran
> sactionFactory 
> hibernate.transaction.manager_class=cirrus.hibernate.transacti
> on.JNDITra
> nsactionManagerLookup
> hibernate.query.substitutions yes 'Y', no 'N' 
> jta.UserTransaction=java:comp/UserTransaction
> 

There was a doco bug that was reported and fixed only recently. 
(My fault.) The property should be

hibernate.transaction.manager_lookup_class

But JNDITransactionManagerLookup is not a valid value. You must 
choose the correct strategy for your application server. Otherwise 
I don't recommend use of usage="read-write" JCS caching.


> Another warning I get with Resin is:
> 
> 04:18:57,258 WARN
> [SessionFactoryObjectFactory] InitialContext did not 
> implement EventContext
> 
> Should I care about it?

Nah, don't worry about that one


** CAUTION - Disclaimer **
This message may contain privileged and confidential
information. If you are not the intended recipient of this
message (or responsible for delivery of the message to
such person) you are hereby notified that any use,
dissemination, distribution or reproduction of this message
is prohibited. If you have received this message in error,
you should destroy it and kindly notify the sender by reply
e-mail. Please advise immediately if you or your employer
do not consent to Internet e-mail for messages of this kind.
Opinions, conclusions and other information in this
message that do not relate to the official business of
Expert Information Services Pty Ltd ("The Company")
shall be understood as neither given nor endorsed by it.

The Company advises that this e-mail and any attached
files should be scanned to detect viruses. The Company
accepts no liability for loss or damage (whether caused
by negligence or not) resulting from the use of any
attached files.
**EIS End of Disclaimer **



---
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



RE: [Hibernate] Lazy Collections

2002-12-04 Thread Gavin King
Cool. You beat me to it. Thanks for the Resin-specific code - I
will integrate it as soon as I get to a PC with CVS access
(I've been unable to do anything the past few days.)

> -Original Message-
> From: Aapo Laakkonen [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, 5 December 2002 2:06 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [Hibernate] Lazy Collections
> 
> 
> > 04:18:56,649 WARN
> > [JTATransactionFactory] No TransactionManagerLookup configured
> > (use of JCS read-write cache is not
> recommended)
> 
> Ok there is error in documentation (it's not 
> hibernate.transaction.manager_class).
> 
> This works: 
> hibernate.transaction.manager_lookup_class=cirrus.hibernate.tr
> ansaction.
> ResinTransactionManagerLookup
> 
> 
> Now it works fine! Great work! Definately the best O/R tool.
> 
> 
> --- code ---
> 
> Here is code for ResinTransactionManagerLookup class:
> 
> package cirrus.hibernate.transaction;
> 
> public final class ResinTransactionManagerLookup extends 
> JNDITransactionManagerLookup {
> 
>   /**
>* @see
> cirrus.hibernate.transaction.JNDITransactionManagerLookup#getName()
>*/
>   protected String getName() {
>   return "java:comp/TransactionManager";
>   }
> 
> }
> 
> --- code ---
> 


** CAUTION - Disclaimer **
This message may contain privileged and confidential
information. If you are not the intended recipient of this
message (or responsible for delivery of the message to
such person) you are hereby notified that any use,
dissemination, distribution or reproduction of this message
is prohibited. If you have received this message in error,
you should destroy it and kindly notify the sender by reply
e-mail. Please advise immediately if you or your employer
do not consent to Internet e-mail for messages of this kind.
Opinions, conclusions and other information in this
message that do not relate to the official business of
Expert Information Services Pty Ltd ("The Company")
shall be understood as neither given nor endorsed by it.

The Company advises that this e-mail and any attached
files should be scanned to detect viruses. The Company
accepts no liability for loss or damage (whether caused
by negligence or not) resulting from the use of any
attached files.
**EIS End of Disclaimer **



---
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



[Hibernate] Re: Hibernate vs. Castor example

2002-12-04 Thread Dave Johnson
In the Hibernate implementation of the DAO, I implement the 
removeNewsfeed method shown below. Why is the call to ses.load()
necessary?

- Dave

  public void removeNewsfeed( Newsfeed feed ) throws DAOException {
removeObject( ag.Newsfeed.class, feed.getId(), feed );
  }
  private void removeObject( Class clazz, String id, Object obj )
throws DAOException {
Session ses = null;
try {
  ses = sessionFactory.openSession();
  obj = ses.load(clazz,id);
  ses.delete(obj);
  ses.flush();
  ses.connection().commit();
}
catch (Exception e) {
  try { ses.connection().rollback(); }
  catch (Exception ex) { e.printStackTrace(); };
  throw new DAOException(e);
}
finally {
  try { ses.close(); }
  catch (Exception ex) { ex.printStackTrace(); };
}
  }




---
This SF.net email is sponsored by: Microsoft Visual Studio.NET 
comprehensive development tool, built to increase your 
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



[Hibernate] Transaction Commit & Session Close

2002-12-04 Thread Aapo Laakkonen
Here is my settings:



  

java:comp/env/jdbc/xa/postgresql/somedb
cirrus.hibernate.sql.PostgreSQLDialect

... mapping files ...





hibernate.use_outer_join=true
hibernate.show_sql=false
hibernate.jdbc.batch_size=10
hibernate.statement_cache.size=20
hibernate.transaction.factory_class=cirrus.hibernate.transaction.JTATran
sactionFactory
hibernate.transaction.manager_lookup_class=cirrus.hibernate.transaction.
ResinTransactionManagerLookup
hibernate.query.substitutions yes 'Y', no 'N'
jta.UserTransaction=java:comp/UserTransaction


I start transaction with this code:

Session session = null;
cirrus.hibernate.Transaction tx = null;

try {

  if (log.isDebugEnabled())
log.debug("Getting Hibernate session.");

  session = this.sessionFactory.openSession();

  if (log.isInfoEnabled())
log.info("Starting database transaction.");

  tx = session.beginTransaction();

And I end the transaction like this:

  if (log.isInfoEnabled())
log.info("Committing database transaction.");

tx.commit();

if (log.isInfoEnabled())
  log.info("Database transaction committed successfully.");

  } catch (SQLException e) {
log.error(e);
this.rollbackTransaction(tx); // just an exception handling helper
func
throw new ServletException(e);
  } catch (HibernateException e) {
log.error(e);
this.rollbackTransaction(tx); // just an exception handling helper
func
throw new ServletException(e);
  } catch (Exception e) {
log.error(e);
this.rollbackTransaction(tx); // just an exception handling helper
func
throw new ServletException(e);
  } finally {

try { session.close();
} catch (SQLException e) {
} catch (HibernateException e) {}

if (log.isDebugEnabled())
  log.debug("Closed Hibernate session.");
  }
}

Everything goes fine until finally block. It gives me warnings:

21:35:24,381 WARN  [JDBCExceptionReporter] SQL Warning: 0, SQLState:
null
21:35:24,381 WARN  [JDBCExceptionReporter] WARNING:  COMMIT: no
transaction in progress

What causes these? Am I doing something wrong? If I tx.commit, do I
still need to close session? If I do, then how do I close session
without the warnings mentioned above?


Regards
Aapo ungle Laakkonen



---
This SF.net email is sponsored by: Microsoft Visual Studio.NET 
comprehensive development tool, built to increase your 
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



RE: [Hibernate] Global Components

2002-12-04 Thread Gavin King
Just use an XML external entity to save yourself the copy/paste.

:)

> -Original Message-
> From: Aapo Laakkonen [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, 5 December 2002 6:09 AM
> To: [EMAIL PROTECTED]
> Subject: [Hibernate] Global Components
> 
> 
> I have need for global components. Here is example of one:
> 
> 
>type="timestamp" unique="false"/>
>column="created_by" unique="false"/>
>unique="false"/>
>column="accepted_by" unique="false"/>
>unique="false"/>
>type="timestamp" unique="false"/>
>column="archived_by" unique="false"/>
>type="timestamp" unique="false"/>
>column="modified_by" unique="false"/>
>unique="false"/>
>type="timestamp" unique="false"/>
>column="deleted_by" unique="false"/> 
> 
> 
> With current implementation I have to copy this definition to 
> all of my mapping files that need to provide metadata. Is 
> there workaround to this? Or is it just me who ever likes to 
> see this kind of functionality?
> 
> 
> 
> Kind Regards
> Aapo ungle Laakkonen
> 
> 
> 
> 
> ---
> This SF.net email is sponsored by: Microsoft Visual Studio.NET 
> comprehensive development tool, built to increase your 
> productivity. Try a free online hosted session at: 
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
___
hibernate-devel mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


** CAUTION - Disclaimer **
This message may contain privileged and confidential
information. If you are not the intended recipient of this
message (or responsible for delivery of the message to
such person) you are hereby notified that any use,
dissemination, distribution or reproduction of this message
is prohibited. If you have received this message in error,
you should destroy it and kindly notify the sender by reply
e-mail. Please advise immediately if you or your employer
do not consent to Internet e-mail for messages of this kind.
Opinions, conclusions and other information in this
message that do not relate to the official business of
Expert Information Services Pty Ltd ("The Company")
shall be understood as neither given nor endorsed by it.

The Company advises that this e-mail and any attached
files should be scanned to detect viruses. The Company
accepts no liability for loss or damage (whether caused
by negligence or not) resulting from the use of any
attached files.
**EIS End of Disclaimer **



---
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



[Hibernate] RE: Lazy Collections (to maverick users)

2002-12-04 Thread Aapo Laakkonen
> What guarantees does Maverick make about when / wether discard() will
be
> called? Is it *guaranteed* to be called in the case of an exception,
etc?

I checked this today, and found out that it gives tou no guarantees,
until I posted a patch.

> -Original Message-
> From: Aapo Laakkonen [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 04, 2002 5:02 AM
> To: [EMAIL PROTECTED]
> Subject: [Mav-user] FW: ModelLifeTime / discard() not guaranteed
> 
> I think that Maverick should guarantee that discard() method of 
> ModelLifetime implementing classes get's called whatever happens
> during rendering view or executing command.
> 
> Here is my modifications to CommandBase class go() method:
>
> ...


Good idea.  Now checked into CVS.

Jeff




---
This SF.net email is sponsored by: Microsoft Visual Studio.NET 
comprehensive development tool, built to increase your 
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



[Hibernate] Global Components

2002-12-04 Thread Aapo Laakkonen
I have need for global components. Here is example of one:


  
  
  
  
  
  
  
  
  
  
  
  



With current implementation I have to copy this definition to all of my
mapping files that need to provide metadata. Is there workaround to
this? Or is it just me who ever likes to see this kind of functionality?



Kind Regards
Aapo ungle Laakkonen




---
This SF.net email is sponsored by: Microsoft Visual Studio.NET 
comprehensive development tool, built to increase your 
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



RE: [Hibernate] Re: Hibernate vs. Castor example

2002-12-04 Thread Gavin King
It isn't usually; not unless you have toplevel collections...

> -Original Message-
> From: Dave Johnson [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, 4 December 2002 4:09 PM
> To: [EMAIL PROTECTED]
> Subject: [Hibernate] Re: Hibernate vs. Castor example
> 
> 
> 
> In the Hibernate implementation of the DAO, I implement the 
> removeNewsfeed method shown below. Why is the call to 
> ses.load() necessary?
> 
> - Dave
> 
> 
>public void removeNewsfeed( Newsfeed feed ) throws DAOException {
>  removeObject( ag.Newsfeed.class, feed.getId(), feed );
>}
> 
>private void removeObject( Class clazz, String id, Object obj )
>  throws DAOException {
>  Session ses = null;
>  try {
>ses = sessionFactory.openSession();
>obj = ses.load(clazz,id);
>ses.delete(obj);
>ses.flush();
>ses.connection().commit();
>  }
>  catch (Exception e) {
>try { ses.connection().rollback(); }
>catch (Exception ex) { e.printStackTrace(); };
>throw new DAOException(e);
>  }
>  finally {
>try { ses.close(); }
>catch (Exception ex) { ex.printStackTrace(); };
>  }
>}
> 
> 
> 
> 
> 
> ---
> This SF.net email is sponsored by: Microsoft Visual Studio.NET 
> comprehensive development tool, built to increase your 
> productivity. Try a free online hosted session at: 
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
___
hibernate-devel mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


** CAUTION - Disclaimer **
This message may contain privileged and confidential
information. If you are not the intended recipient of this
message (or responsible for delivery of the message to
such person) you are hereby notified that any use,
dissemination, distribution or reproduction of this message
is prohibited. If you have received this message in error,
you should destroy it and kindly notify the sender by reply
e-mail. Please advise immediately if you or your employer
do not consent to Internet e-mail for messages of this kind.
Opinions, conclusions and other information in this
message that do not relate to the official business of
Expert Information Services Pty Ltd ("The Company")
shall be understood as neither given nor endorsed by it.

The Company advises that this e-mail and any attached
files should be scanned to detect viruses. The Company
accepts no liability for loss or damage (whether caused
by negligence or not) resulting from the use of any
attached files.
**EIS End of Disclaimer **



---
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



RE: [Hibernate] Enhancements to the Hibernate Xdoclet subtasks

2002-12-04 Thread Joel Rosi-Schwartz




   Okay, I have gone through
the Hibernate schema and the Xdoclet xdt and have I made the changes that
I *think* brings the module in line with changes made for 1.1. I have attached
the xdt and would appreciate if those of you who are more familiar with these
could double check what I have done. Search on 'JRS'
to find the places I made modifications; there are only five. Note, these
are only the chnages to reflect what has been deprecated in the schema migration
to 1.1. In the next round of work I will tackle adding support for new features.
Please see my remarks in line below for guidance of the changes.
 
 After I get some feed back on this I will update the unit test to reflect 
these changes and make certain everything actually runs. Then I will commit 
this stage back to cvs.
 
 - joel
 
 Joel Rosi-Schwartz wrote:
 

I have diff'ed  hibernate-mapping.dtd and hibernate-mapping-1.1.dtd. Many
of the changes seem to be because you have tightened up the schema going
 from #IMPLIED to explicit values in many places. Do any of these require
changes to the the hibernate xdt in ...xdocklet.resorces?
  
  The changes that I have found that may need handling are:
 
  
 has been added
 
the allowed values for  has changed
length> has been
removed 
  
 
 removed from xdt.
 

 
   
 
   
  
 has been added
generated-key>  has been
removed
  
  
 found no support in xdt
 
   
  
generated-key>  has been
 removed
  
 
 found no support in xdt
 
   
  
length> has been 
removed
  
 
 removed from xdt.
 
   
  
type>  has been removed
  
 
 removed from xdt.
 
   
  
  has been added
  has been added
  has been removed
  
 
 removed from xdt.
 
 Is this
list complete? Which of these changes require addition, removal or change
to the xcdoclet subtasks?
  
  I can not find any reference to composite-id in hibernate xdoclet, so I 
am assuming that it something that needs support added rather than modified.
 Is this accurate?
  
  I am going to move on and look at how the hibernate dtd correlates to the
 xdoclet dtd, but some guidance and insight will save me some time and effort.
 In the meantime I am finding it valuable to gain an understanding of the
hibernate schema, I am certain that will have a payback later in my projects.
One moan however, I wish you had used Xschema I am really rusty at dtd. (This
is not intended to start a meaningless thread on the pro and cons of using
dtd vs. xschema, there are volumes filled with that one already ;-) 
  
   - joel
 
 
 
 






hibernate.tools.xdt.zip
Description: Zip compressed data