Re: [Hibernate] Hibernate aspects

2004-09-25 Thread Gavin King
Bill Burke wrote:
I'm not sure about these, just writing what comes into my head:
* setting FlushMode
* session disconnect/reconnect
* enabling filters in HB3
Hi all,
I'm trying to brainstorm a list of aspects for Hibernate that could be 
written with JBoss AOP.

The first one I can think of is:
* Session injection.
public class AccountDAO {
  public @Injected(name="Sessionname") Session session;
}
When you access the session variable, it determine if you are within 
the context of a transaction.  If so, it will automatically create the 
Hibernate session and associate it with the transaction.  When the 
transaction is finished the session will be closed.

We're also considering supporting local variable annotations, so 
instead of a member variables, you could could use the annotation as a 
local variable

public void someMethod() {
   @Injected(name="Sessionname") Session session = null;
}
Any other you can think of?
Thanks,
Bill

--
Gavin King
+61 410 534 454
+1 404 822 8349
callto://gavinking
Hibernate
[EMAIL PROTECTED]
http://hibernate.org
JBoss Inc
[EMAIL PROTECTED]
http://jboss.com

---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


Re: [Hibernate] simple persistence solution needed

2004-09-25 Thread Gavin King
I think there could be three different pieces to this:
(1) SQL rendering
(2) JDBC wrappers
(3) A metamodel for relational data
Currently, Hibernate has classes for rendering things like inserts, 
updates,
selects, outer joins, case where, in, etc in the .sql package. However, the
APIs here are probably not especially convenient, so you might want to 
heavily
refactor this stuff.

We do not have any JDBC framework for stuff like "executing an insert", or
"running a query", however we do have some primitives for parameter binding
and reading result sets (the Hibernate Types). We would need to grow some
classes for actually executing SQL and handling exceptions correctly, etc.
We *do* have Batcher for abstracting the JDBC batch API.
We have a relational metamodel as part of the .mapping package, however it
is only really adapted to DDL generation, whereas I think a really useful
facility would be able to also conventiently generate DML (on top of the
SQL rendering stuff).
Alexey Loubyansky wrote:
Hello colleagues,
there are areas in JBoss that need persistence solutions. Right now each
area has its own more or less ugly solution (not because of developers'
skills but more because of JDBC portability issues, differences in
database data types, etc). We could use Hibernate. But Hibernate is a
solution for business domain persistence and looks like too much for our
local problems.
So what is in fact needed is some very simple persistence API and the
ability to generate database schema (in fact one-two tables) which
guarantees portability across database products and can be re-used in
different areas in JBoss.
Up to this level, it's not really a big problem and I could implement it
as a separate library but after some discussions there was a decision to
try and add (or maybe just externalize/refactor) this functionality in
Hibernate.
First of all I would appreciate comments from the Hibernate team on
this. Is the problem more or less clear? How would you imagine this done
in Hibernate? What should I start with? What branch? Any other comments,
ideas?
Thanks!
alex
---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

--
Gavin King
+61 410 534 454
+1 404 822 8349
callto://gavinking
Hibernate
[EMAIL PROTECTED]
http://hibernate.org
JBoss Inc
[EMAIL PROTECTED]
http://jboss.com

---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


Re: [Hibernate] Fetch strategy changes

2004-09-25 Thread Gavin King
Emmanuel Bernard wrote:
(1) make lazy default to true on both  and 
   mapping elements; if a class cannot be proxied, laziness
   is transparently disabled; make it clear that we intend
   laziness to be used 99% of the time

Most controversial part but I'm +1 from a pragmatic perspective. 
However, I can understand people thinking it's a bit too much since 
it's not 100% sure you can lazy, and the '1 query to bind them all' is 
a very common urban legend.
I've implemented it to log a WARN if we cant create a proxy.
(4) introduce the fetch attribute, where, at least initially,
   the options are fetch="join|select"; eventually we may
   add other options like fetch="immediate-select"

+1 immediate-select means unlazy but wo join, correct ?
Correct
Questions:
* The default should be fetch="select" for collections, what
 should the default be for to-one associations? I suppose
 that purely for backward compatibility purposes we need
 fetch="auto|join|select", where auto is the default, and
 chooses "select" for a lazy-enabled class.

To stay consistent with (4), add a default value (I know one more). 
I've never been fond of the 'auto'-magical configuration. It has 
confused tons of guys I've worked with.
Since we expect everything to be lazy=true now, the behavior becomes 
MUCH more predictable. Basically, it will almost always be "select", 
when unspecified.

We *must* provide a clear and clean material on what to do to lazy, 
fetch a collection a to-one etc... We'll need a clean separation 
between H2 and H3 docs (whether wiki or not).
Yes, certainly.

--
Gavin King
+61 410 534 454
+1 404 822 8349
callto://gavinking
Hibernate
[EMAIL PROTECTED]
http://hibernate.org
JBoss Inc
[EMAIL PROTECTED]
http://jboss.com

---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel