Re: [Hibernate] Looking for Volunteers

2002-10-15 Thread Jon Lipsky
Yes, now that makes sense...  I'm going to have to think this through a
little more, because my current code doesn't take that into consideration.

You were right when you said this is a "little involved"... :-)

- Original Message -
From: "Gavin King" <[EMAIL PROTECTED]>
To: "Jon Lipsky" <[EMAIL PROTECTED]>
Cc: "hibernate list" <[EMAIL PROTECTED]>
Sent: Tuesday, October 15, 2002 4:13 AM
Subject: Re: [Hibernate] Looking for Volunteers


> > Currently in the MultiTableEntityPersister there fields such as
> > "subclassTableNameClosure" that get initialized with the information
about
> > the persistant objects subclasses.  Currently, when I get the persister
> for
> > the object "Multi" above, I get information about Simple, Multi, and
> > SubMulti.  The inclusion of SubMulti in the information is currently
what
> is
> > causing my trouble in generating the SQL statements since I am not using
> > outer joins between the tables containing Simple and Multi (and
SubMulti,
> > since it get's included right now.)
>
> Yes, SubMulti should be included. Because when we load an object by id or
by
> a query we don't know if it might be an instance of a subclass at the time
> the SQL query is issued. So what happens is that often Hibernate uses a
> different persister to *initialize* the object to the one it uses to query
> the database. So each MultiTableEntityPersister has the "tableNames" field
> to hold all tables used to persist the state of the concrete class, and
the
> "subclassTableNameClosure" field to hold all tables used to persist the
> state of that class and, potentially, its subclasses.
>
> Make sense?
>
> - Original Message -
> From: "Jon Lipsky" <[EMAIL PROTECTED]>
> To: "Gavin King" <[EMAIL PROTECTED]>
> Cc: "hibernate list" <[EMAIL PROTECTED]>
> Sent: Tuesday, October 15, 2002 12:22 AM
> Subject: Re: [Hibernate] Looking for Volunteers
>
>
> > Hey Gavin,
> >
> > I'm still working on getting the query functionality working with the
> > MultipleTableEntityPersister and I have a question that you may be able
to
> > answer before I go spend hours and hours tracing the functionality.
> >
> > In order to understand my question, I've attached the mapping xml that I
> am
> > currently testing with:  (which is a modified version of the one
currently
> > checked into CVS.)
> >
> > 
> >
> >  
> >   
> >
> >   
> >   
> >   
> >   
> >   
> >
> >table="subclass">
> >
> >
> >
> >
> >   
> >
> >table="nuthasubclass">
> >
> >
> >
> >
> >
> >
> >
> >
> > 
> > 
> >
> >
> > table="submulti">
> > 
> > 
> >
> >
> >   
> >
> >  
> >
> > 
> >
> > Now for the question:
> >
> > Currently in the MultiTableEntityPersister there fields such as
> > "subclassTableNameClosure" that get initialized with the information
about
> > the persistant objects subclasses.  Currently, when I get the persister
> for
> > the object "Multi" above, I get information about Simple, Multi, and
> > SubMulti.  The inclusion of SubMulti in the information is currently
what
> is
> > causing my trouble in generating the SQL statements since I am not using
> > outer joins between the tables containing Simple and Multi (and
SubMulti,
> > since it get's included right now.)
> >
> > My question is, did you intend to load the information about SubMulti in
> to
> > the arrays?  Before I go and change something, I wanted to see what your
> > original intention of that was.
> >
> > Thanks,
> > Jon...
> >
> >
> > - Original Message -
> > From: "Gavin King" <[EMAIL PROTECTED]>
> > To: "Jon Lipsky" <[EMAIL PROTECTED]>
> > Cc: "hibernate list" <[EMAIL PROTECTED]>
> > Sent: Saturday, October 12, 2002 4:53 AM
> > Subject: Re: [Hibernate] Looking for Volunteers
> >
> >
> > > Ace! Thanks Jon ... looking forward :)
> > >
> > > - Original Message -
> > > From: "Jon Lipsky" <[EMAIL PROTECTED]>
> > > To: "Gavin King" <[EMAIL PROTECTED]>
> > > Cc: <[EMAIL PROTECTED]>
> > > Sent: Saturday

Re: [Hibernate-devel] Queries on objects with composite keys...

2002-05-15 Thread Jon Lipsky
I had the same idea for the syntax, but I wanted to make sure you agreed
with that before I dove in and started working on it.

As a quick hack just to get my app up and running I patched Hibernate to
allow me to queries like:

from foo in class eg.Foo where foo.subid = 69

However I didn't feel like this was an accurate representation of the object
relationships so I now I'd like to do it right.

It might take a few days to implement this since I'm in the middle of
another project, but since I need this in quite a few places I am motivated
to implement this.

Cheers,
Jon...

- Original Message -----
From: 
To: "Jon Lipsky" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, May 15, 2002 11:46 AM
Subject: Re: [Hibernate-devel] Queries on objects with composite keys...


>
>
> >> I am correct in my findings that you cannot currently do queries based
> on composite keys where you only want to select using only 1 of the
> composite key properties?  The only way currently supported is to do a
> "find" for the object using the composite key object, right?
>
> Yeah, thats about right. Nor can you frame queries that would require a
> table join on the composite key.
>
> >> I ended up patching Hibernate so you can do a select based on the
> composite key, however I think the way I did it is only valid as a
> temporary solution.  I would be willing to work on adding complete query
> support for composite keys if anyone else thinks there is demand for this.
>
> Sounds great! Any work you could do in this area is _much_
> appreciated!Exactly what are you proposing? I'm thinking a syntax
something
> like:
>
> from foo in class eg.Foo where foo.id.subid = 69
>
> where id is the composite identifier of eg.Foo.
>
> I apologise for all the hand-written parsing code for the query language.
I
> knew zero about lexing + parsing at the time so I ended up doing by hand
> what I should have used ANTLR for. It was my intention to reimplement the
> query language using an antlr grammar I wrote later. (Yeah, I educated
> myself since.) However, since this is the very first feature request to do
> with queries, I'm now inclined to leave alone a feature that seems to be
> serving everyone quite well :)
>
> Thanks for the offer of help
>
> peace
>
> Gavin
>


___

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
___
Hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



Re: [Hibernate-devel] mvc & lazy loading

2002-08-27 Thread Jon Lipsky
Hi All,

I use a Filter (a new addition in the 2.3 servlet spec) to open and close my
Hibernate sessions.  By doing it this way it doesn't matter if I am using
Velocity or JSP or something else to access Hibernate.  As far as the "view"
is concerned the Hibernate session just exists, and only the Filter has to
worry about opening and closing it.

I was looking at the examples inclued with Hibernate and I was thinking that
maybe an example should be added of using a Filter since it's a good way to
cleanly seperate the creation and closing of the sessions for a web
application.

Jon...

PS - Here is a code snippet to get you started if you want to do it this
way:

package example;

import cirrus.hibernate.Datastore;
import cirrus.hibernate.Session;
import cirrus.hibernate.SessionFactory;
import cirrus.hibernate.Hibernate;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

public class HibernateFilter implements Filter
{
 static org.apache.log4j.Category log =
org.apache.log4j.Category.getInstance(HibernateFilter.class.getName());

 private Datastore datastore;
 private SessionFactory sessions;

 public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException
 {
  try
  {
   // Get the http session id from the request, then we will try to get the
Hiberate
   // Session from the request.  If it doesn't exist, then we will create
it, otherwise
   // we will use the one that already exists.
   String vSessionId =
((HttpServletRequest)request).getSession(true).getId();
   Session vSession = (Session)request.getAttribute(vSessionId);

   if (vSession == null)
   {
vSession = sessions.openSession();
request.setAttribute(vSessionId, vSession);

if (log.isDebugEnabled())
{
 log.debug("Opened hibernate session.");
}
   }
  }
  catch (Exception exc)
  {
   log.error("Error opening Hibernate session.", exc);
  }

  try
  {
   chain.doFilter(request, response);
  }
  finally
  {
   try
   {
String vSessionId = ((HttpServletRequest)request).getSession().getId();
Session vSession = (Session)request.getAttribute(vSessionId);

// Only try to close the connection if it is open, since it might have
been
// closed somewhere else by mistake.
if (vSession.isOpen())
{
 vSession.close();

 if (log.isDebugEnabled())
 {
  log.debug("Closed hibernate session.");
 }
}
   }
   catch (Exception exc)
   {
log.error("Error closing Hibernate session.", exc);
   }
  }
 }

 public void init(FilterConfig aConfig) throws ServletException
 {
  // Initialize your datastore
  datastore = Hibernate.createDatastore();

  // Initialize your the object -> db mappings
  // ...

  // Initialize your session
  sessions = datastore.buildSessionFactory();
 }

 public void destroy()
 {

 }
}



- Original Message -
From: "Christoph Sturm" <[EMAIL PROTECTED]>
To: "Brad Clow" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, August 27, 2002 10:47 AM
Subject: Re: [Hibernate-devel] mvc & lazy loading


> Hi Brad!
>
> This subject is an interesting one that I was also thinking of lately.
> I did a test app with maverick (mav.sourceforge.net), and there it was
> really easy. If the controller(=model) implements ModelLifetime, a discard
> function is called when the views are finished and the model is discarded.
> There I closed my session. Other frameworks that just forward to the view
> dont offer this functionality.
> For most of my stuff I use webwork, so I'd like a solution that works
there
> too. I was thinking of closing the session in the finalize method of my
> controller, but then I dont really know when the session will be closed.
> Another possibility would be to to pass the session to velocity, and close
> it in the velocity view servlet after all is rendered.
>
> How did you implement it?
>
> regards
>  chris
> - Original Message -
> From: "Brad Clow" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, August 27, 2002 12:38 AM
> Subject: [Hibernate-devel] mvc & lazy loading
>
>
> >
> > to date, we have avoided using lazy loading when writing a web app in
> > one of the standard mvc type frameworks (eg. struts, webwork, etc).
> > this is because objects r typically retrieved, placed in the request
> > attributes, session closed and control is then passed to the view (JSP,
> > velocity, etc).  if the view attempts to access a lazy loaded collection
> > in one of the objects an exception is thrown as the associated session
> > is closed.
> >
> > what do other people do?
> >
> > yesterday, i spent a few hours writing a very simple webapp framework
> > that uses velocity for the view.  it enables the velocity rendering to
> > be done while a session is open.  so far this is working quite well for
> > us.
> >
> > comments?
> >
> > brad
> >
> > > ___
> > > brad clow
> > > chief technical officer
> > > workingmous

Re: [Hibernate] Looking for Volunteers

2002-10-14 Thread Jon Lipsky
Hey Gavin,

I'm still working on getting the query functionality working with the
MultipleTableEntityPersister and I have a question that you may be able to
answer before I go spend hours and hours tracing the functionality.

In order to understand my question, I've attached the mapping xml that I am
currently testing with:  (which is a modified version of the one currently
checked into CVS.)



 
  
   
  
  
  
  
  

  
   
   
   
   
  

  
   
   
   

   
   

   


   

   


   

  

 



Now for the question:

Currently in the MultiTableEntityPersister there fields such as
"subclassTableNameClosure" that get initialized with the information about
the persistant objects subclasses.  Currently, when I get the persister for
the object "Multi" above, I get information about Simple, Multi, and
SubMulti.  The inclusion of SubMulti in the information is currently what is
causing my trouble in generating the SQL statements since I am not using
outer joins between the tables containing Simple and Multi (and SubMulti,
since it get's included right now.)

My question is, did you intend to load the information about SubMulti in to
the arrays?  Before I go and change something, I wanted to see what your
original intention of that was.

Thanks,
Jon...


- Original Message -
From: "Gavin King" <[EMAIL PROTECTED]>
To: "Jon Lipsky" <[EMAIL PROTECTED]>
Cc: "hibernate list" <[EMAIL PROTECTED]>
Sent: Saturday, October 12, 2002 4:53 AM
Subject: Re: [Hibernate] Looking for Volunteers


> Ace! Thanks Jon ... looking forward :)
>
> - Original Message -
> From: "Jon Lipsky" <[EMAIL PROTECTED]>
> To: "Gavin King" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Saturday, October 12, 2002 2:04 AM
> Subject: Re: [Hibernate] Looking for Volunteers
>
>
> > Hi Gavin,
> >
> > I spent a few hours today working on this, and I think I have it about
> > finished.
> >
> > - It can now handle two columns with the same name in different tables.
> > - It now will work for both Oracle and Ansi style joins
> > - It works for insert, update, and load by primary key.
> >
> > All I have left to do is finish the "select" code, and then I'll submit
it
> > for you to play around with.  Right now, the code for generating the
> selects
> > is about finished, all I have left to do is to figure out how to get the
> > portion of the select statement needed to load the MultipleTableEntity
in
> > sync with the rest (Right now the alias names don't match up.)
> >
> > I'll won't be able to continue working on this until Monday, so don't
> expect
> > anything before then.
> >
> > Jon...
> >
> >
> > - Original Message -
> > From: "Gavin King" <[EMAIL PROTECTED]>
> > To: "Jon Lipsky" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Friday, October 11, 2002 9:27 AM
> > Subject: Re: [Hibernate] Looking for Volunteers
> >
> >
> > > I'm pre-warning you that this will be a bit involved, Jon - and you
will
> > > probably have to change the Loadable interface, refactoring some stuff
> > thats
> > > currently done in the Loader hierarchy onto the EntityPersister
> > classes.
> > >
> > > I don't have an existing testcase, but if you add a many-to-one
> > association
> > > to some class in Multi.hbm.xml, that will be enough.
> > >
> > > MultiTableEntityPersister implements table-per-subclass persistence.
> > > EntityPersister implements the old-style persistence.
> > >
> > > Currently MultiTableEntityPersister is a valid implementation of
> > operations
> > > from ClassPersister and Queryable but *not* of all operations defined
on
> > > Loadable. ie. MultiTableEntityPersister defines the operations needed
by
> > > SimpleEntityLoader but not by OuterJoinLoader.
> > >
> > > At the moment, I am generating SQL along the lines of:
> > >
> > > select
> > > t.id as id1, t.clazz as clazz1, t.prop as prop1,
> > > t1.subprop as subprop1
> > > from roottable t
> > > left outer join subtable t1
> > > on t.id = t1.id
> > >
> > > for the _query_ stuff. That will have to change in a couple of ways:
> > >
> > > (1) it doesn't handle the case of two columns with the same name in
> > > different tables
> > > (2) it shouldnt always be an outerjoin really  sometimes it should
> be
> > > just a join
> > 

Re: [Hibernate-devel] mvc & lazy loading

2002-09-03 Thread Jon Lipsky
Hi Chris,

Yes, you are correct...  I'm not quite sure what I was thinking when I put
that in there... :-)  This was a simplified version of my real code to be
used an example for all of you, and I guess I made a mistake when I was
doing that. What I really meant to express is that you might want to
generate an ID that is used as the key to store the Hibernate session in the
request.  By doing this, you can use multiple instances of the filter to
support multiple Hibernate sessions to different databases.

Thanks for finding my mistake so I could clarify my original intention of
that "vSessionId" variable!

Jon...

- Original Message -
From: "Christoph Sturm" <[EMAIL PROTECTED]>
To: "Jon Lipsky" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, September 03, 2002 12:21 PM
Subject: Re: [Hibernate-devel] mvc & lazy loading


> Hey Jon!
>
> I also think that this is a great idea :)
>
> What i dont like about your approach is that it always creates a session.
>
> >String vSessionId =
> > ((HttpServletRequest)request).getSession(true).getId();
> >Session vSession = (Session)request.getAttribute(vSessionId);
>
> Why did you do it this way? Is it not ok to use a string constant as
> attribute name?
>
> I think my approach will be to open the session in the controller, and
close
> it only in the filter, if there is an open session.
>
> regards
>  chris
>
>
>
> - Original Message -
> From: "Jon Lipsky" <[EMAIL PROTECTED]>
> To: "Christoph Sturm" <[EMAIL PROTECTED]>; "Brad Clow"
> <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, August 27, 2002 11:46 AM
> Subject: Re: [Hibernate-devel] mvc & lazy loading
>
>
> > Hi All,
> >
> > I use a Filter (a new addition in the 2.3 servlet spec) to open and
close
> my
> > Hibernate sessions.  By doing it this way it doesn't matter if I am
using
> > Velocity or JSP or something else to access Hibernate.  As far as the
> "view"
> > is concerned the Hibernate session just exists, and only the Filter has
to
> > worry about opening and closing it.
> >
> > I was looking at the examples inclued with Hibernate and I was thinking
> that
> > maybe an example should be added of using a Filter since it's a good way
> to
> > cleanly seperate the creation and closing of the sessions for a web
> > application.
> >
> > Jon...
> >
> > PS - Here is a code snippet to get you started if you want to do it this
> > way:
> >
> > package example;
> >
> > import cirrus.hibernate.Datastore;
> > import cirrus.hibernate.Session;
> > import cirrus.hibernate.SessionFactory;
> > import cirrus.hibernate.Hibernate;
> >
> > import javax.servlet.*;
> > import javax.servlet.http.HttpServletRequest;
> > import java.io.IOException;
> >
> > public class HibernateFilter implements Filter
> > {
> >  static org.apache.log4j.Category log =
> > org.apache.log4j.Category.getInstance(HibernateFilter.class.getName());
> >
> >  private Datastore datastore;
> >  private SessionFactory sessions;
> >
> >  public void doFilter(ServletRequest request, ServletResponse response,
> > FilterChain chain) throws IOException, ServletException
> >  {
> >   try
> >   {
> >// Get the http session id from the request, then we will try to get
> the
> > Hiberate
> >// Session from the request.  If it doesn't exist, then we will
create
> > it, otherwise
> >// we will use the one that already exists.
> >String vSessionId =
> > ((HttpServletRequest)request).getSession(true).getId();
> >Session vSession = (Session)request.getAttribute(vSessionId);
> >
> >if (vSession == null)
> >{
> > vSession = sessions.openSession();
> > request.setAttribute(vSessionId, vSession);
> >
> > if (log.isDebugEnabled())
> > {
> >  log.debug("Opened hibernate session.");
> > }
> >}
> >   }
> >   catch (Exception exc)
> >   {
> >log.error("Error opening Hibernate session.", exc);
> >   }
> >
> >   try
> >   {
> >chain.doFilter(request, response);
> >   }
> >   finally
> >   {
> >try
> >{
> > String vSessionId =
> ((HttpServletRequest)request).getSession().getId();
> > Session vSession = (Session)request.getAttribute(vSessionId);
> >
> > // Only try to close the connection if it is ope

Re: [Hibernate-devel] release plans (was: Queries on objects with composite keys...)

2002-05-18 Thread Jon Lipsky
I found the test class and I was able to run them with no problem.  I'll 
probably have time to add the tests for the composite-key queries on 
Monday or Tuesday...  If you are going to release a new version next 
week, I will probably hold off submitting my patches until I can apply 
them to the new version just to be safe.

On Saturday, May 18, 2002, at 05:53  AM, 
Gavin_King/[EMAIL PROTECTED] wrote:

I just wanted to give you a quick update... I have the query by
composite keys working now. I will do some more testing throughout
the weekend and early next week to make sure that everything else still
works. If it everything checks out with no problems, I'll post the
patches the middle of next week.
Great! Have you figured out how to run FooBarTest yet? If so, could you 
add
tests of the composite key query funtion in there. The class Fum is the
existing composite-key test class (but feel free to add your own).

I will probably release 0.9.12 before middle-of-next week, so this might
miss out on the next release. So my plans are looking like:
0.9.12 - as soon as I finish the configurable discriminator column code
0.9.13 - integrate other people's patches (by Christoph Beck + Jon 
Lipsky)
- documentation
1.0rc1 - [Feature Freeze]
- more TestCases (probably port existing tests to JUnit)
- documentation!
1.0.0 - (I hope)

The only thing that could throw this off is if a rework of the Session 
API
(as suggested by Anton) is really necessary. Even then, I'm tempted to
delay it to version 1.1 to let the dust settle

___
Hundreds of nodes, one monster rendering program.
Now that's a super model! Visit http://clustering.foundries.sf.net/
___
Hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


___
Hundreds of nodes, one monster rendering program.
Now that's a super model! Visit http://clustering.foundries.sf.net/
___
Hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


[Hibernate-devel] Using streams for binary types

2002-06-07 Thread Jon Lipsky
Hi,

I just checked in a change to add support for using streams when setting
binary types.  I don't know about other databases, but Oracle has a
limitation on the number of bytes you can set when you use setBytes to
update a LONG RAW column.  If you want to store more data than this limit,
then you need to use streams, otherwise you will get an Oracle exception.

I added a new hibernate property that allows you to toggle this
functionality on and off since other databases don't have this limitation.
The system property that I added is:

hibernate.use_streams_for_binary

By setting this to true, it will use streams to both get and set the binary
types.

Cheers,
Jon...


___

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

___
Hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



[Hibernate-devel] Is this type of query possible?

2002-07-01 Thread Jon Lipsky



Hi,
 
I've managed to get all of my direct JDBC calls 
replaced except for one.  I can't figure out how to write this particular 
query using the hibernate query language, so I'm not even sure it is 
possible.  If it's not possible then I'll take the time to implement it, 
however I wanted to make sure first.
 
Below is an example of the resulting SQL that I 
want to create:
 
select foo.id, foo.namefrom foowhere foo.id 
in(   select foo_attr.id_foo   from 
foo_attr   where (foo_attr.id_attribute = 'attribute1' and 
foo_attr.strvalue = 'value1')    and id_foo in   
(   select 
foo_attr.id_foo   from 
foo_attr   where (foo_attr.id_attribute = 
'attribute2' and foo_attr.strvalue = 'value2')     
))
 
Basically, there is a parent table ("foo" in my 
example above) and there is list of attributes for a particular foo object 
(called "foo_attr") in my example above.  I want to find all Foo's where it 
have an attribute "attribute1" equal to "value1" and an attribute "attribute2" 
equal to "value2".
 
So, is this something I will have to implement (and 
if so, are there suggestions on the syntax of the query), or does this already 
exist?
 
Thanks,
Jon...


Re: [Hibernate-devel] Queries on objects with composite keys...

2002-05-18 Thread Jon Lipsky
Hi...

I just wanted to give you a quick update...  I have the query by composite
keys working now.  I will do some more testing throughout the weekend and
early next week to make sure that everything else still works.  If it
everything checks out with no problems, I'll post the patches the middle of
next week.

Cheers,
Jon...

- Original Message -
From: 
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 15, 2002 2:42 PM
Subject: Re: [Hibernate-devel] Queries on objects with composite keys...


>
> Cool. Looking forward to it.
>
> Peace
>
> >> It might take a few days to implement this since I'm in the middle of
> another project, but since I need this in quite a few places I am
motivated
> to implement this.
>
>
> ___
>
> Have big pipes? SourceForge.net is looking for download mirrors. We supply
> the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
> ___
> Hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel
>


___

Hundreds of nodes, one monster rendering program.
Now that’s a super model! Visit http://clustering.foundries.sf.net/
___
Hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



Re: [Hibernate-devel] RE: JMX/JBoss

2002-08-08 Thread Jon Lipsky
I've had a similar problem using Orion as the application server and I've
been trying to solve it for a while with no luck.

I know the required jar's are in the classpath because it can find the
classes with no problem, however when I try to load a resource from the same
jar it can't find it.  Trying to figure out the class loading of a J2EE
server is a nightmare.  FYI - The only way I was able to solve the problem
up till now was either to put the classes in the server's classpath, or to
put the jar's in the the WEB-INF/lib directory if they are only used by the
web application (though this doesn't solve the problem when it comes to
MBean usage.)

Jon...

- Original Message -
From: 
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 08, 2002 2:19 AM
Subject: RE: [Hibernate-devel] RE: JMX/JBoss


>
> >I put the mapping files with the classes in the EJB jar file and fired up
> >JBoss.  I got the following back:
> >
> >Embedded Exception Hibernate lazy instantiation problem: Resource:
> >/com/vetconnect/client/dao/Client.hbm.xml not found;
> >nested exception is:
> >javax.ejb.EJBException: null Embedded Exception Hibernate lazy
> instantiation
> >problem: Resource: /com/vetconnect/client/dao/Client.hbm.xml not found
>
> Damn! I really don't understand why the following line wouldn't work:
>
>   ds.storeResource(
> resources[i], Thread.currentThread().getContextClassLoader()
>   );
>
> ( in SessionFactoryStub.getImpl() ). Have I got it totally wrong, or isn't
> Thread.currentThread.getContextClassLoader() meant to get the classloader
> used by the calling EJB? Perhaps I'm hallucinating...
>
> >The only way I can see making this MBean useful is if users put all their
> >mapped classes and mappings in the server's classpath.  Then they can put
> >them all in one mapping or split them up and it won't matter because the
> >MBean and SessionFactoryStub will have access to them.
>
> Well, it would work. but seems suboptimal. Theres got to be *some* way for
> a thread servicing an EJB method call to get hold of the EJB's *own*
> classloader doesn't there???
>
> >What do you want to do with this?
>
> I dunno.
>
>
>
> ---
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> ___
> Hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel
>



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
Hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



[Hibernate] Question about onUpdate

2002-09-11 Thread Jon Lipsky



Hi Gavin (and all the rest),
 
It appears to me that the onUpdate() method is not 
getting called when it should.  I have an object then implements the 
Lifecycle interface, and I have run a simple test with it where I create an 
object, load an object, update an object, and delete an object.  Just 
for testing I added "System.out" messages in each of the callbacks.  The 
callbacks get called for everything except for "onUpdate".  Has anyone else 
noticed this problem?
 
Before I go digging around and trying to fix this, 
I wanted to make sure no one else was working on it.
 
Jon...
 
PS - Is anyone working on adding outer join support 
for Oracle?  If not, then I'd like to volunteer to do 
this.


Re: [Hibernate-devel] proposed API change

2002-08-25 Thread Jon Lipsky
I like this change...  All of the developers I have introduced Hibernate to
have had this problem.  They all thought (because of the names of the
methods) that each method would do what the other one did.

My 2 cents...

Jon...

- Original Message -
From: 
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 25, 2002 7:57 AM
Subject: [Hibernate-devel] proposed API change


> In this post:
>
> http://sourceforge.net/forum/forum.php?thread_id=722838&forum_id=128638
>
> Yaron Zakai makes a suggestion I quite like.
>
> I've seen that new users often have trouble realizing they need to use
> insert() instead of save() when they want to use application-assigned ids.
> People seem to expect that the "assigned" id generator will just use the
> existing id of an object when you call save().
>
> Secondly, some people would like insert() to cascade to insert(). Whereas
> other times insert() to save() is appropriate.
>
> So I would like to deprecate the following methods:
>
>   Session.insert(Object)
>   Session.insert(Object, Serializable)
>
> and add the following method
>
>   Session.save(Object, Serializable)
>
> (which does exactly what Session.insert(Object, Serializable) used to do.)
>
> Then we would deprecate the IDGenerator interface and replace it with:
>
> public interface IdentifierGenerator {
>   public Serializable generate(SessionImplementor session, Object entity)
> throws . ;
> }
>
> Then the assigned id generator would return the current value of the
> entity's id property, instead of throwing an exception.
>
> So instead of:
>
>   session.insert(o)
>
> you use
>
>   session.save(o)
>
> This would allow a save() to cascade to either an "insert" or a "save"
> depending upon the id generator in use. You can still always assign your
> own id (regardless of what id generator is used) by calling
>
>   session.save(o, id)
>
> In favor of this change:
>
>  * it won't break any existing code
>  * its more flexible
>  * its more understandable to new users
>  * its very easy to implement
>
> On the downside, it requires deprecations of methods on the central API
> interface, which is not something that should be done without due
> consideration.
>
> NEways this feels right to me. Opinions?
>
>
>
> ---
> This sf.net email is sponsored by: OSDN - Tired of that same old
> cell phone?  Get a new here for FREE!
> https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
> ___
> Hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel
>



---
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
___
Hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



[Hibernate] Queries with composite id's

2003-01-09 Thread Jon Lipsky
Title: Message



Hi,
 
I recently upgraded 
one of our applications from Hibernate 1.0 (or one of the release around there) 
to Hibernate 1.2.  My queries that depend on the properties of a composite 
id no longer work.  
 
I know that used to 
work because I was the one who added it originally, but now it doesn't seem to 
work.  Before I go digging though the code, has support for this been 
removed on purpose or is perhaps a byproduct of QueryParser 
refactoring?
 
Thanks,
Jon...


[Hibernate] Oracle Style Joins Implemented

2002-09-24 Thread Jon Lipsky



Hi,
 
I've implemented outer join support for Oracle 
8.  (Oracle 9 supports the ANSI style outer joins.)
 
I know Gavin is working on some refactoring right 
now, so I wanted to make sure my work doesn't interfere with his before I check 
the patches in.  In order to implement this, I had to modify the following 
files (along with what I did):
 
Environment.java - Added a "useOracleJoins" 
environment parameter
 

Loader.java - Added helper methods to generate the 
additions to the from and the where clause for the Joins
 
CollectionLoader.java - Added check for join type, 
and then generate ANSI joins or Oracle joins.
 
EntityLoader.java - Added check for join type, and 
then generate ANSI joins or Oracle joins.
 
OneToManyLoader.java - Added check for join type, 
and then generate ANSI joins or Oracle joins.
 
 
 
Gavin, if this sounds alright to you, and doesn't 
conflict with your refactoring, then I will check this in.
 
Thanks,
Jon...
 


Re: [Hibernate] Implentation of Outer Join for Oracle

2002-09-27 Thread Jon Lipsky
Hi,

All of the functionality is added and everything is checked into CVS.  If
you find anything wrong, let me know, and I'll be glad to fix it.

Regarding your comment about Oracle 9 users wanting to use the ANSI style
joins.  I know it would add more properties (to the already large number),
but it might be nice to be able to specify Dialect specific properties.
This would allow the user to toggle which outer join style to use for this
Dialect.

Jon...

- Original Message -
From: "Gavin King" <[EMAIL PROTECTED]>
To: "Jon Lipsky" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Friday, September 27, 2002 2:51 PM
Subject: Re: [Hibernate] Implentation of Outer Join for Oracle


> All very sound. The only likely objection is that Oracle 9 users might
want
> to use ANSI style joins for the few people who would have this issue can
> easily subclass OracleDialect.
>
> At some stage it would be really nice to develop a hierarchy of classes
that
> model SQL statements, eg. SQLUpdate, SQLSelect, SQLSelectOrderBy, etc
>
> At present Hibernate models SQL statements with  java.lang.StringBuffer,
> which is what you get if you follow YAGNI too devoutly :(
>
> - Original Message -
> From: Jon Lipsky
> To: [EMAIL PROTECTED]
> Sent: Friday, September 27, 2002 10:22 PM
> Subject: [Hibernate] Implentation of Outer Join for Oracle
>
>
> Hi Gavin,
>
> I finally have time try to add the Oracle joins stuff into the new
> refactored version of Hibernate in CVS.
>
> I want to run my ideas by you before I do them, to make sure you agree
(and
> to make sure I understand your refactorings correctly :-)
>
> 1) Refactor the outer join generation into a seperate class so that the
> current OuterJoinLoader calls a seperate class to actually create the SQL
> statement fragments.
>
> 2) Add the ability for a dialect to specify which OuterJoinGenerator to
use.
>
> 3) Add an OracleOuterJoinGenerator (based on the code I've already written
> for the 1.1 version of Hibernate).
>
> 4) Modify OuterJoinLoader so that it has two possible places it can add to
> the SQL statement. ie.. After the FROM part of the SQL is generated and
> after the WHERE clause.  So, for example, in the CollectionLoader, when it
> is generating the SQL, it would do something like:
>
>   sql = sqlSelect(
>// SELECT CLAUSE
>selectCollectionString(persister, alias) +
>( joins==0 ? "" : ", " + selectString(associations) ),
>// FROM CLAUSE
>persister.getQualifiedTableName()+' '+alias,
>// OUTER JOINS PART 1
>outerJoinStringAfterFrom(associations),
>// WHERE CLAUSE
>whereString( persister.getKeyColumnNames(), alias ),
>// OUTER JOINS PART 2
>outerJoinStringAfterWhere(associations),
>// ORDER BY CLAUSE
>( persister.hasOrdering() ) ?
> alias + '.' + persister.getSQLOrderByString() :
> null
>   );
>
> What do you think of that idea?  Doing it this way wouldn't require the
> addition of an Environment variable like my previous solution, and it
would
> allow us to add other outer join strategies if needed.
>
> Jon...
>



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



Re: [Hibernate-devel] XML SessionFactory configuration

2002-06-12 Thread Jon Lipsky
I think this makes sense, and I definately have a use for it.  I've
implemented more or less the same thing at the web application level where
with a ServletContext Listener that  listens for the ServletContextCreated
event and creates a SessionFactory and stores it in the application scope.

With this in place, I would no longer need this code, and I could share the
SessionFactory between the instances of the web application.

- Original Message -
From: 
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 12, 2002 9:40 AM
Subject: [Hibernate-devel] XML SessionFactory configuration


>
> I've been thinking about the problem of configuring a SessionFactory for
> a J2EE application where application code has no control over the system
> initialization procedure. I'm thinking that instead of forcing the
> application to do this programmatically, there could be a config file
> like:
>
>  
>
>false
>true
> ="jta.UserTransaction">java:comp/UserTransaction/
>
>
>  my/first/datasource
>  
>  
>
>
>
>  my/other/datasource
>  
>
>
>  
>
> What I'm thinking of is that a call to
>
> Hibernate.configure()
>
> would look for a resource called hibernate.cfg.xml and use that to
> configure and register SessionFactory(s) with JNDI. Subsequent
> calls would do nothing. That way application components could all
> call Hibernate.configure() when instantiated but we would guarantee
> that the factories would only be initialized once.
>
> I dont want to see an explosion of configuration files but I think
> this is reasonable.
>
> Opinions? Suggestions?
>
> I will check in some code sometime in the next couple of days for
> people to play with
>
> Gavin.
>
>
> ___
>
> Sponsored by:
> ThinkGeek at http://www.ThinkGeek.com/
> ___
> Hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel
>


___

Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
___
Hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



Re: [Hibernate] Oracle error: exceeded simultaneous SESSIONS_PER_USER limit

2003-01-02 Thread Jon Lipsky
Hi Matt,

From your example code that you posted, it doesn't seem like you were  
ever closing the sessions you opened.  Is this true, or are you perhaps  
doing it somewhere else in your code?

The way that I handle Hibernate sessions in all of my applications is  
to use a ServletFilter that opens a Hibernate session at the beginning  
of the request, and then closes the Hibernate session at the end of the  
request.  It makes everything so much cleaner if you can just assume  
that that Hibernate session will be there for you whenever you need it,  
and that it will be closed when you are done using it.

If you want, I can send you a code snippet.   Just let me know...

I don't know if you have the same situation that I have, but for half  
of my requests, I don't actually need the Hibernate session, so I  
recently enhanced my ServletFilter to actually create a Proxy object  
that looks like a Hibernate session.  If and when my application tries  
to call a method on the Proxy object, then the Proxy object initialized  
the session, and away we go, otherwise we never actually waste the  
effort of opening a database connection.

I would think that a combination of my ServletFilter approach and your  
current ThreadLocal approach would take care of all of your problems.

Regards,
Jon...
Let me know if you want to
On Thursday, January 2, 2003, at 09:01  PM, Matt Raible wrote:
I *think* I fixed this problem by implementing a Connection Pool in  
Tomcat and
configuring Hibernate with a HibernationSession (using ThreadLocal) and
talking to Oracle using that method.  Seems to only open one  
connection now.

Thanks,

Matt

I'm getting the following error when using Hibernate as my persistence
layer:
java.sql.SQLException: ORA-02391: exceeded simultaneous  
SESSIONS_PER_USER
limit ORA-02063: preceding line from NAS_AC_72
ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit ORA-02063:
preceding line from NAS_AC_72

Could this be caused by Hibernate?  I'm hoping not, but I don't know  
enough
about it to argue with the DBA that Hibernate (and my code) is not the
problem.  Here's is a sample class I'm using to connect:

public class ChangeRequestDAOHibernate extends BaseDAOHibernate  
implements
ChangeRequestDAO {
private static SessionFactory sessionFactory;
private static Datastore datastore;
private Log log =  
LogFactory.getLog(ChangeRequestDAOHibernate.class);

public ChangeRequestDAOHibernate() throws DAOException {
try {
datastore = Hibernate.createDatastore();
datastore.storeClass(com.cable.comcast.dmc.itd.cct.persistence.ChangeR 
equest
.class);

// build a SessionFactory
sessionFactory = datastore.buildSessionFactory();
} catch (MappingException e) {
throw new DAOException(e);
} catch (HibernateException e) {
throw new DAOException(e);
}
}
	/**
	 * @see
com.cable.comcast.dmc.itd.cct.persistence.ChangeRequestDAO#getHeadends 
(MSO)
	 */
	public List getHeadendsForMSO(MSO mso) throws DAOException {
		Session ses = null;
		List headendList = null;
		
		try {
			ses = sessionFactory.openSession();

			List changeRequests =
(List) ses.find("from cr in class
com.cable.comcast.dmc.itd.cct.persistence.ChangeRequest where  
cr.msoId=?",
		mso.getId(),
Hibernate.LONG);

			if ((changeRequests == null) ||
(changeRequests.size() == 0)) {
log.warn("No headends found for msoId: " +
mso.getId());
return new ArrayList();
			}
			
			// if results are found, look up the headend names
and build a list of headend objects
			LookupDAO lookupDAO = new LookupDAOHibernate();
			List headendIds = new ArrayList();
			
			// loop though the change requests and build a list
of headends
			for (int i=0; i < changeRequests.size(); i++) {
ChangeRequest cr = (ChangeRequest)
changeRequests.get(i);
Headend h = new Headend();
h.setId(cr.getHeadendId());		
headendIds.add(h);		
			}
			
			headendList = lookupDAO.getHeadendNames(headendIds);

} 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();
}
}
		return headendList;

	}

}

---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


-- Matt Raible, Raible Designs, Morrison CO US
-- Tel: +1 303 979

[Hibernate-devel] Feature for Lazy Initialization using Proxies

2002-06-11 Thread Jon Lipsky



Hi...
 
I patched my version of Hibernate with a 
feature that I think is useful, but before I committed it I wanted make sure 
everyone agrees with what I have done and if we should make this feature 
configurable, etc...
 
Normally if you open a session, load or find some 
object, then close the session you will be unable to access the objects with a 
many-to-one relation if it is setup to use lazy initialization.
 
I modified the LazyInitializer so that instead of 
throwing an exception because the session is closed, it will open a new 
connection and reconnect the session if the session, do the find, and the close 
the session again...  This way I only have to load the objects I really 
need at runtime, and I don't need to worry about managing the 
session.
 
If anyone has any comments on this kind of 
functionality, then I would definately like to hear them.
 
Thanks,
Jon...


Re: [Hibernate] RE: DistributedCacheConcurrencyStrategy

2002-10-07 Thread Jon Lipsky
Hi,

I myself really like the idea of the DistributedCacheConcurrency.  (Of
course, I'm being a little selfish since I have an immediate use for it.)
Christian, if you need any help to finish, and/or test it, please let me
know.  I have an application already written which would be a good test for
this.

Gavin, since your hesitant to add yet another dependency into the codebase,
have you thought about adding a "hibernate-optional.jar" to the project that
could contain non-core, but useful things like this?

Jon...

- Original Message -
From: "Gavin King" <[EMAIL PROTECTED]>
To: "Christian Meunier" <[EMAIL PROTECTED]>
Cc: "hibernate list" <[EMAIL PROTECTED]>
Sent: Sunday, October 06, 2002 7:13 PM
Subject: Re: [Hibernate] RE: DistributedCacheConcurrencyStrategy


> I *finally* had a chance to look over your work on this: pretty cool, I
like
> it. Not yet convinced that we want to introduce a JavaGroups dependency
into
> the main codebase, but you could work on me and I might capitulate :)
>
> > I thought how to achieve maximum flexibility and keep a clean code for
the
> cache, i came up with the following
> > design that makes more sense IMHO than using a
> DistributedCacheConcurrency:
>
> > (1) Define a lockserver interface
> > (2) Implement a local lockserver
> > (3) Implement a centralized lockserver
> > (4) Optionally implement a distributed lockserver  ( the one i actually
> did but i believe centralized one makes more sense)
>  > (5) Refactor the ReadWriteCacheConcurrency: [snip]
> > (6) Refactor the  tag so we can: [snip]
>
> Yup, all thats quite acceptable.
>
> > (7) Add a remove method to the Cache interface so we allow
implementation
> such the proposed "lightweight readwrite" ( see my previous email) to use
> it. Clearly state in the javadoc tag that using this method an
> implementation can not fully ensure tx isolation in all case.
>
> Sounds reasonable.
>
>
> > What is the correct behaviour regarding the lockserver, i believe i did
> something wrong in the distributable prototype, i mean when we try to
> acquire a lock and the server responds saying the object is already
locked.
> Should we then go to the database ( what i currently do ) or wait and
retry.
> > I believe the latter is the correct answer.
>
> Nope, we should go straight to the database. Hibernate threads never ever
> wait for each other.
>
> Thanks Christian, sorry for not addressing this sooner. Just been *very*
> busy.
>
>
>
>
> ---
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> ___
> hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel
>



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



Re: [Hibernate-devel] How do you get hold of a javax.transaction.Transaction?

2002-06-14 Thread Jon Lipsky
I think this might have to be yet another configurable property.

I needed to do this using Orion as my application server, and here is how I
did it:

TransactionManager manager = (TransactionManager)new
InitialContext().lookup("java:comp/UserTransaction");

However, I don't know if it works the same on other applications servers...

Jon...

- Original Message -
From: 
To: <[EMAIL PROTECTED]>
Sent: Friday, June 14, 2002 12:53 PM
Subject: [Hibernate-devel] How do you get hold of a
javax.transaction.Transaction?


> Does anyone know a reasonably portable way to get hold of a
> javax.transaction.Transaction or javax.transaction.TransactionManager
> from an application server JNDI server?
>
> If I knew how to do this, I could get the caching stuff working
> properly for situations where the JTA transaction is incomplete when
> we call Session.close(). We would need to register an instance
> of javax.transaction.Synchronization with the
> javax.transaction.Transaction instance.
>
> (At present, for the cache to work correctly, the transaction must
> be either fully committed or rolled back when you close the Session.)
>
> Gavin
>
>
> ___
>
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink
>
> ___
> Hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel
>


___

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - 
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

___
Hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



Re: [Hibernate] Oracle Style Joins Implemented

2002-09-24 Thread Jon Lipsky



Hi Chris,
 
Yes, that was my initial thought however I thought 
it would complicate things even more to move the join implementation into 
the Dialects.  The first thing is that we would need two Oracle dialects, 
one for Oracle 8, and one for Oracle 9 since Oracle 9 *CAN* use ANSI style outer 
joins.  The other thing is that the SQL statements are genererated a little 
differently between the two join styles.  That would then move some of the 
SQL generation into the dialects, so I decided to leave it in the Loader 
classes.
 
Perhaps Gavin has a better idea than using the 
Environment variable.?.?  
 
Jon...

  - Original Message - 
  From: 
  Christoph Sturm 

  To: Jon Lipsky ; [EMAIL PROTECTED] 
  
  Sent: Tuesday, September 24, 2002 3:20 
  PM
  Subject: Re: [Hibernate] Oracle Style 
  Joins Implemented
  
  Hey Jon!
   
  Oracle Outer Joins are great, I have been needing 
  this for quite some time :)
   
  But wouldnt it be better to let the database 
  Dialect decide what kind of outer joins is generated instead of introducing a 
  new parameter?
   
  regards
   chris
   
  
- Original Message - 
From: 
Jon Lipsky 
To: [EMAIL PROTECTED] 

Sent: Tuesday, September 24, 2002 3:06 
PM
Subject: [Hibernate] Oracle Style Joins 
Implemented

Hi,
 
I've implemented outer join support for Oracle 
8.  (Oracle 9 supports the ANSI style outer joins.)
 
I know Gavin is working on some refactoring 
right now, so I wanted to make sure my work doesn't interfere with his 
before I check the patches in.  In order to implement this, I had to 
modify the following files (along with what I did):
 
Environment.java - Added a "useOracleJoins" 
environment parameter
 

Loader.java - Added helper methods to generate 
the additions to the from and the where clause for the Joins
 
CollectionLoader.java - Added check for join 
type, and then generate ANSI joins or Oracle joins.
 
EntityLoader.java - Added check for join type, 
and then generate ANSI joins or Oracle joins.
 
OneToManyLoader.java - Added check for join 
type, and then generate ANSI joins or Oracle joins.
 
 
 
Gavin, if this sounds alright to you, and 
doesn't conflict with your refactoring, then I will check this 
in.
 
Thanks,
Jon...
 


[Hibernate] Implentation of Outer Join for Oracle

2002-09-27 Thread Jon Lipsky



Hi Gavin,
 
I finally have time try to add the Oracle joins 
stuff into the new refactored version of Hibernate in CVS.
 
I want to run my ideas by you before I do them, to 
make sure you agree (and to make sure I understand your refactorings correctly 
:-)
 
1) Refactor the outer join generation into a 
seperate class so that the current OuterJoinLoader calls a seperate class to 
actually create the SQL statement fragments.
 
2) Add the ability for a dialect to specify which 
OuterJoinGenerator to use.
 
3) Add an OracleOuterJoinGenerator (based on the 
code I've already written for the 1.1 version of Hibernate).
 
4) Modify OuterJoinLoader so that it has two 
possible places it can add to the SQL statement. ie.. After the FROM part 
of the SQL is generated and after the WHERE clause.  So, for example, in 
the CollectionLoader, when it is generating the SQL, it would do something 
like:
 
  sql = 
sqlSelect(   // SELECT 
CLAUSE   selectCollectionString(persister, alias) 
+   ( joins==0 ? "" : ", " + selectString(associations) 
),   // FROM 
CLAUSE   persister.getQualifiedTableName()+' 
'+alias,   // OUTER JOINS PART 
1   outerJoinStringAfterFrom(associations),   // 
WHERE CLAUSE   whereString( persister.getKeyColumnNames(), 
alias ),
   // OUTER JOINS PART 
2   outerJoinStringAfterWhere(associations),   // 
ORDER BY CLAUSE   ( persister.hasOrdering() ) 
?alias + '.' + persister.getSQLOrderByString() 
:null  );
 
What do you think of that idea?  Doing it this 
way wouldn't require the addition of an Environment variable like my previous 
solution, and it would allow us to add other outer join strategies if 
needed.
 
Jon...


Re: [Hibernate] Looking for Volunteers

2002-10-11 Thread Jon Lipsky
Hi Gavin,

I spent a few hours today working on this, and I think I have it about
finished.

- It can now handle two columns with the same name in different tables.
- It now will work for both Oracle and Ansi style joins
- It works for insert, update, and load by primary key.

All I have left to do is finish the "select" code, and then I'll submit it
for you to play around with.  Right now, the code for generating the selects
is about finished, all I have left to do is to figure out how to get the
portion of the select statement needed to load the MultipleTableEntity in
sync with the rest (Right now the alias names don't match up.)

I'll won't be able to continue working on this until Monday, so don't expect
anything before then.

Jon...


- Original Message -
From: "Gavin King" <[EMAIL PROTECTED]>
To: "Jon Lipsky" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, October 11, 2002 9:27 AM
Subject: Re: [Hibernate] Looking for Volunteers


> I'm pre-warning you that this will be a bit involved, Jon - and you will
> probably have to change the Loadable interface, refactoring some stuff
thats
> currently done in the Loader hierarchy onto the EntityPersister
classes.
>
> I don't have an existing testcase, but if you add a many-to-one
association
> to some class in Multi.hbm.xml, that will be enough.
>
> MultiTableEntityPersister implements table-per-subclass persistence.
> EntityPersister implements the old-style persistence.
>
> Currently MultiTableEntityPersister is a valid implementation of
operations
> from ClassPersister and Queryable but *not* of all operations defined on
> Loadable. ie. MultiTableEntityPersister defines the operations needed by
> SimpleEntityLoader but not by OuterJoinLoader.
>
> At the moment, I am generating SQL along the lines of:
>
> select
> t.id as id1, t.clazz as clazz1, t.prop as prop1,
> t1.subprop as subprop1
> from roottable t
> left outer join subtable t1
> on t.id = t1.id
>
> for the _query_ stuff. That will have to change in a couple of ways:
>
> (1) it doesn't handle the case of two columns with the same name in
> different tables
> (2) it shouldnt always be an outerjoin really  sometimes it should be
> just a join
>
> but thats enough to get us started. Baby steps. So if you generate
something
> similar for outerjoin loading, we will be in business.
>
> P.S. I just noticed that because MultiTableEntityPersister doesn't support
> outerjoin loading, it also can't be loaded by CollectionLoader or
> EntityLoader. So this is an important thing to finish.
>
>
> - Original Message -
> From: "Jon Lipsky" <[EMAIL PROTECTED]>
> To: "Gavin King" <[EMAIL PROTECTED]>
> Sent: Friday, October 11, 2002 4:34 PM
> Subject: Re: [Hibernate] Looking for Volunteers
>
>
> > Hi Gavin,
> >
> > Not a problem.  If you can point me to a valid test case for this, I'd
be
> > more than willing to make sure the outer join fetching works.
> >
> > Jon...
> >
> >
> > - Original Message -
> > From: "Gavin King" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, October 09, 2002 6:56 PM
> > Subject: [Hibernate] Looking for Volunteers
> >
> >
> > > Okay, I finally have something concrete for normalized
> > (table-per-subclass)
> > > mappings. I went down a couple of wrong paths before I decided on the
> best
> > > approach (a completely new implementation of ClassPersister).
> > >
> > > I can save/load/update/delete instances already.
> > >
> > > We need (in order of importance):
> > >
> > > * SchemaExport support (and proper support in the mapping document)
> > > * Query language integration (the hard bit)
> > > * Support for outerjoin fetching
> > > * Support for versioning (easy)
> > > * support for native id-generation (not very hard)
> > >
> > > If anyone wants to help out with any of these problems, I would very
> much
> > > appreciate it.
> > >
> > > ( In particular, since Jon Lipsky understands the outerjoin fetching
> code,
> > > maybe he would have a look at that stuff? )
> > >
> > > I'm perhaps being slightly over-eager here, since I still need to
rework
> > the
> > > map package part of this; what I've got there now is kludge. But I
will
> do
> > > that (and finish it) tomorrow. When I do that, it will knock the top
> item
> > > off the list by side-effect and make the other items doable.
> > >

RE: [Hibernate] Queries with composite id's

2003-01-09 Thread Jon Lipsky
Title: RE: [Hibernate] Queries with composite id's





Yep, that fixed it...  Thanks!


(Sorry for getting you worried that something was broken. :-)


-Original Message-
From: One Ovthafew [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 09, 2003 1:18 PM
To: [EMAIL PROTECTED]
Subject: Re: [Hibernate] Queries with composite id's



Ahah - I think I know now what has changed :)


Do the XXXHistoryImpl classes inherit XXXImpl?


If so, then the solution is simply to add polymorphism="explicit" to your mapping documents.



-
Never lose a fax again, receive faxes to your personal email account! Visit http://www.mbox.com.au/fax



---
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com ___

hibernate-devel mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel





RE: [Hibernate] Moving Hibernate objects with SOAP

2003-08-14 Thread Jon Lipsky
Title: RE: [Hibernate] Moving Hibernate objects with SOAP





Hi Josh,


I needed to send my objects over SOAP as well (though using GLUE, not Axis).  What I ended up doing was write a custom serializer/deserializer that would write my hibernate data objects to and from XML.  When I want to send the object over the wire, it is serialzed to XML, and then on the client side it deserialzed back into it's object state.  Doing it this way means that I have fine control over how much of the data hibernate lazily loads, meaning it only loads what I want it to send over the wire.

The methods that are exposed with SOAP just send byte arrays around, and there is an API that wraps those methods that to handle the deserialization/serialization.  Doing it this way allowed me to avoid having to add special "DTO" objects into my model.

Regards,
Jon...


-Original Message-
From: Josh Rehman [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, August 07, 2003 2:46 AM
To: [EMAIL PROTECTED]
Subject: [Hibernate] Moving Hibernate objects with SOAP



Hello all,


I'd like to move Hibernate generated objects (generated with hbm2java, 
of course) across the wire with SOAP.


There are two problems:


First, Hibernate generates collection accessors. This is great, but 
these are, by necessity, untyped. The Axis serializer cannot handle this.


Second, it often comes to pass that we are only interested in a subset 
of the object. In particular, we often do NOT want to move an entire 
collection accross the wire. Unfortunately, the serializer will call all 
accesors on the hibernate object, and CGLIB will, of course, do it's job 
and get everything known about that object.


We have so far tried to solve these problems by writing an additional 
code generator that creates so-called "Data Transfer Objects" (Fowler's 
term, also abreviated DTO) that have a) typed array accessors, and b) 
the ability to specify a subset of interesting properties. We aren't 
quite done with this effort, but it's so far working out well. The DTOs 
are generated by delegating work to an underlying hibernate class.


Has anyone faced and solved, these probelms? If so, I'd like to hear 
about it. In particular, I was hoping that there is something obvious 
that I may have missed.


With kind regards,
Josh Rehman




---
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01

___
hibernate-devel mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel





RE: [Hibernate] Using Hibernate from a ServletFilter

2003-01-09 Thread Jon Lipsky
Title: RE: [Hibernate] Using Hibernate from a ServletFilter





Hi Matt,


I know Christian just posted a mail that he uses a ThreadLocal variable to handle this, and that is one solution.  


I use do it similar to how you describe it below, in that my web layer and my unit tests take care of opening the session and they pass it down to the persistance layer.  I do this because within some requests I need to have multiple transactions running, so I wanted fine grained control over the opening and closing of sessions.  

For 90% of the cases, the session that is opened by the ServletFilter will be the only session that I need, however there are enough instances where I need finer control that I decided to that passing the session to the persistance layer is the way to go.

I think you could easily combine the two approaches.  The ServletFilter could be modified to initialize a ThreadLocal variable, and then you could use that to get the session that you pass to the persistance layer.  You could also setup your JUnit test cases to initialize the same ThreadLocal variable with the session, so that the business logic would look that same for both cases.  All that would change is an introduction of a servlet filter in your web tier, and the introduction of Session intialization code into your test cases.

Jon...


-Original Message-
From: Matt Raible [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 09, 2003 2:13 PM
To: Jon Lipsky; '[EMAIL PROTECTED]'; 'Raible,Matt'
Subject: Re: [Hibernate] Using Hibernate from a ServletFilter



Jon - this looks great.  I'm assuming this works great when calling DAOs or Hibernate persistence classes directly from the web tier.  If I have the following layers

web (action classes)
service (business logic)
persistence (daos)


And I'd like to use JUnit/Cactus to test them all.  If I use your filter, I'm guessing I'll have to pass the Session object all the way down to the persistence layer?  What is the recommended way to do this.

Furthermore, if I architect my app in this way, for my test cases, should I obtain a session in the TestCase and then pass that in to my methods?  

All suggestions/recommendations welcome.  You can see my example app (and how I'd doing it now) by downloading my struts-resume application from (http://www.raibledesigns.com/downloads).

I'd like to figure out the best way to do this, as this struts-resume app is going to end up in a book, and I'm assuming some folks might use it as an example to architect there apps.

Thanks,


Matt


> Hi All,
>  
> I said in an email last week that I would post an example of how to 
> use Hibernate from a ServletFilter.
>  
> Hopefully this example works because I copied and pasted it together 
> from the real one we are removing to remove some of the other 
> dependencies that we have.  If somone finds a problem with it, let me 
> know, and I'll try to help you with it.
>  
> I am attaching 3 files to this email:
>  
> HibernateFilter.java - The source code for the ServletFilter 
> SessionProxy - A proxy object that looks like a Hibernate session so 
> that the session can be initialized when first used. web.xml - An 
> example web.xml file that shows you how to configure the 
> HibernateFilter
>  
> The ServletFilter assumes that you are initializing the Hibernate 
> datastore somewhere else, you could also modify the init() method of 
> the HibernateFilter to initialize the datastore and session factories 
> if you wanted.  (That is actually what I do, but I removed that part 
> to simplify the example.)  On each request it will create a 
> HibernateSession (or a proxy that looks like a session) and store it 
> in a request attribute.  At the end of the request, it will close it 
> for you (in the case you use a proxy object, it will close the session 
> only if you initialized the session.)
>  
> Jon...



---
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com ___

hibernate-devel mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel





RE: [Hibernate] Queries with composite id's

2003-01-09 Thread Jon Lipsky
Title: RE: [Hibernate] Queries with composite id's





Ok this is really weird.  I'm not so sure that this is a problem with composite-id's now.


Here is the query that it fails on:


SELECT Posting FROM Posting IN CLASS com.xxx.tex.dao.posting.PostingImpl , 
Attr1 IN CLASS com.xxx.tex.dao.posting.PostingAttributeImpl , 
Attr2 IN CLASS com.xxx.tex.dao.posting.PostingAttributeImpl , 
Attr3 IN CLASS com.xxx.tex.dao.posting.PostingAttributeImpl , 
Attr4 IN CLASS com.xxx.tex.dao.posting.PostingAttributeImpl  
WHERE Attr1.postingAttributeId.attributeId = 'product'  
AND Posting.postingId = Attr1.postingAttributeId.postingId  
AND Attr1.stringValue = ?  
AND Posting.postingId = Attr2.postingAttributeId.postingId  
AND Attr2.postingAttributeId.attributeId = 'medium'  
AND Attr2.stringValue = ?  
AND Posting.postingId = Attr3.postingAttributeId.postingId  
AND Attr3.postingAttributeId.attributeId = 'product_type'  
AND Attr3.stringValue = ?  
AND Posting.postingId = Attr4.postingAttributeId.postingId  
AND Attr4.postingAttributeId.attributeId = 'grade'  
AND Attr4.stringValue = ? 
AND Posting.postingId = Attr1.postingAttributeId.postingId  
AND Posting.postingType.postingTypeId IN (0,1)



The error that it gives is:


cirrus.hibernate.QueryException: unresolved property: postingAttributeId


The weird thing is that in the exception, it says the query that it is parsing was:



SELECT Posting FROM Posting IN CLASS com.xxx.tex.dao.posting.PostingHistoryImpl , 
Attr1 IN CLASS com.xxx.tex.dao.posting.PostingAttributeHistoryImpl , 
Attr2 IN CLASS com.xxx.tex.dao.posting.PostingAttributeHistoryImpl , 
Attr3 IN CLASS com.xxx.tex.dao.posting.PostingAttributeHistoryImpl , 
Attr4 IN CLASS com.xxx.tex.dao.posting.PostingAttributeHistoryImpl  
WHERE Attr1.postingAttributeId.attributeId = 'product'  
AND Posting.postingId = Attr1.postingAttributeId.postingId  
AND Attr1.stringValue = ?  
AND Posting.postingId = Attr2.postingAttributeId.postingId  
AND Attr2.postingAttributeId.attributeId = 'medium'  
AND Attr2.stringValue = ?  
AND Posting.postingId = Attr3.postingAttributeId.postingId  
AND Attr3.postingAttributeId.attributeId = 'product_type'  
AND Attr3.stringValue = ?  
AND Posting.postingId = Attr4.postingAttributeId.postingId  
AND Attr4.postingAttributeId.attributeId = 'grade'  
AND Attr4.stringValue = ? A
ND Posting.postingId = Attr1.postingAttributeId.postingId  
AND Posting.postingType.postingTypeId IN (0,1)


If you notice the "PostingImpl" has been changes to "PostingHistoryImpl" and the "PostingAttributeImpl" has been changed to "PostingAttributeHistoryImpl".

I'm not quite sure why this is happening.


I do have mapping entries for "PostingHistoryImpl" and "PostingAttributeHistoryImpl" classes.  They are similar to the non history Impl classes in that they implement the same interfaces.  The datamodel that I am programming to has the "history" tables seperated from the "current" tables, so that is why I have something like this.

Since "postingAttributeId" is a composite id that led me to believe that this is the problem, since that is similar to the error that I was getting a few months ago before we added support for composite-id queries.  However, now that I have looked at it a little closer, I think something else may be happinging?   Any ideas?

Jon...


-Original Message-
From: One Ovthafew [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 09, 2003 12:38 PM
To: [EMAIL PROTECTED]
Subject: Re: [Hibernate] Queries with composite id's



>> I recently upgraded one of our applications from Hibernate 1.0 (or
one of the release around there) to Hibernate 1.2.  My queries that depend on the properties of a composite id no longer work. <<

Yick!! I'm very surprised.I paid special attention to this in the test suite, because I knew it was something that could easily break

Yes, please go digging. (This is very bad.)


What exactly does the query look like?


Gavin


-
Never lose a fax again, receive faxes to your personal email account! Visit http://www.mbox.com.au/fax



---
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com ___

hibernate-devel mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel