You can subscribe to this list here.
2002 |
Jan
(2) |
Feb
(157) |
Mar
(111) |
Apr
(61) |
May
(68) |
Jun
(45) |
Jul
(101) |
Aug
(132) |
Sep
(148) |
Oct
(227) |
Nov
(141) |
Dec
(285) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(518) |
Feb
(462) |
Mar
(390) |
Apr
(488) |
May
(321) |
Jun
(336) |
Jul
(268) |
Aug
(374) |
Sep
(211) |
Oct
(246) |
Nov
(239) |
Dec
(173) |
2004 |
Jan
(110) |
Feb
(131) |
Mar
(85) |
Apr
(120) |
May
(82) |
Jun
(101) |
Jul
(54) |
Aug
(65) |
Sep
(94) |
Oct
(51) |
Nov
(56) |
Dec
(168) |
2005 |
Jan
(146) |
Feb
(98) |
Mar
(75) |
Apr
(118) |
May
(85) |
Jun
(75) |
Jul
(44) |
Aug
(94) |
Sep
(70) |
Oct
(84) |
Nov
(115) |
Dec
(52) |
2006 |
Jan
(113) |
Feb
(83) |
Mar
(217) |
Apr
(158) |
May
(219) |
Jun
(218) |
Jul
(189) |
Aug
(39) |
Sep
(3) |
Oct
(7) |
Nov
(4) |
Dec
(2) |
2007 |
Jan
|
Feb
(2) |
Mar
(7) |
Apr
(3) |
May
(3) |
Jun
(8) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(4) |
Nov
(7) |
Dec
|
2008 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2009 |
Jan
(6) |
Feb
|
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(10) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(3) |
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Gavin K. <ga...@ap...> - 2002-10-02 07:59:09
|
> session.setLockMode( LockMode.NONE ); Not really desirable (or possible to implement?), because 1. objects loaded by outerjoining cannot by loaded in any other mode than SHARED. 2. locks are always released at transaction commit time, which means you have to reacquire them explicitly and theres several other complications which would make the semantics of session.setLockMode(LockMode.EXCLUSIVE) very doubtful. > Also, just out of curiosity, is there any support for implementing > pessimistic locking for databases that don't support it directly? E.g. one > lo-tech way is to require a "locked" column in the table in question, which > is set to true to lock the record, and reset when the record is updated and > the lock released. I'm not suggesting that Hibernate should implement this Ah, I think its an undesirable kind of approach (theres all kind of problems with releasing locks in failure modes) that would bloat Hibernate considerably. And, as you say, it can be done at an application-level if necessary. |
From: Anton v. S. <an...@ap...> - 2002-10-02 07:36:46
|
The locking API looks fine to me, although I'm no expert on locking strategies. One thing which did occur to me: might it make sense to have either a session-wide and/or transaction-wide locking setting, e.g. to support something like: session.setLockMode( LockMode.NONE ); ...that affects all objects subsequently loaded in the session or transaction. Or is there an equivalent to this already? Also, just out of curiosity, is there any support for implementing pessimistic locking for databases that don't support it directly? E.g. one lo-tech way is to require a "locked" column in the table in question, which is set to true to lock the record, and reset when the record is updated and the lock released. I'm not suggesting that Hibernate should implement this necessarily, but it might be nice to have the ability to plug in that type of behavior, or an alternative, if it's needed in a particular application. Not sure if this qualifies as GonnaNeedIt. One application where I saw this used was for a document manager, where the lock could potentially persist over quite some time, including e.g. through a database restart. Perhaps this is out of scope here, though - that kind of thing can easily be implemented as a layer above Hibernate, although having it integratable might be neat. Anton |
From: Gavin K. <ga...@ap...> - 2002-10-02 06:43:38
|
Could people do me a favor + check out the new locking API and let me know what they think. 'Cos if no-one else has any very strong opinions on this stuff, I might as well release it in the next version. TIA Gavin |
From: Anton v. S. <an...@ap...> - 2002-10-02 06:13:27
|
> sessionFactory.openDatabinder().toXML(foo); > > does a really nice job of printing an object..... Isn't that more like: sessionFactory.openDatabinder().bind(foo).toXML(); ...or is my version out of sync? Great feature, btw! |
From: Anton v. S. <an...@ap...> - 2002-10-02 05:26:31
|
...or am I being thick, and most stringifying can pretty much be done with toXML and an appropriate stylesheet? |
From: Anton v. S. <an...@ap...> - 2002-10-02 04:45:48
|
> On the other hand, > > sessionFactory.openDatabinder().toXML(foo); > > does a really nice job of printing an object..... I haven't tried that, but I will, thanks. This made me think some more... Ideally, having a single method with fixed behavior for something like this, on a class like Hibernate or Session, may not be such a good idea. It would be better if the behavior were customizable or pluggable, and perhaps that would lead to a different interface style anyway. Perhaps the code to do this could be packaged as a class which a developer could use to implement their own final result, i.e. provide methods that allow the components of an object's string representation to be arranged differently, abbreviated, or whatever. This could have the additional benefit of not needing to extend any existing classes or interfaces, and being more orthogonal to the core Hibernate persistence functionality. Anton |
From: Gavin K. <ga...@ap...> - 2002-10-02 03:32:42
|
I prefer Anton's suggestion. There used to be a method like this on the session interface A Long Time Ago but I got rid of it because I didn't think it had anything to do with persistence. On the other hand, sessionFactory.openDatabinder().toXML(foo); does a really nice job of printing an object..... ----- Original Message ----- From: "Anton van Straaten" <an...@ap...> To: "Brad Clow" <bra...@wo...>; <hib...@li...> Sent: Wednesday, October 02, 2002 8:40 AM Subject: RE: [Hibernate] writing the properties of a persistent object to a string > I would find this useful. I rely on toString quite a bit. > > I assume that printToString could be added somewhere else, but would then > require a session object as a parameter? Or would that be very unnatural? > Design niceties aside, that would work fine for me. Would adding it to the > Hibernate class be any better from a reduced-interface-clutter perspective? > > Anton > > > -----Original Message----- > From: hib...@li... > [mailto:hib...@li...]On Behalf Of Brad Clow > Sent: Tuesday, October 01, 2002 5:43 PM > To: hib...@li... > Subject: [Hibernate] writing the properties of a persistent object to a > string > > > i often add a toString method (that prints out the values of all properties) > to my persistent objects so that i can get detailed logging of an object's > state when it is loaded, saved, etc. i have just written a printToString > method for the Session interface/SessionImpl class that does this > dynamically, taking into account proxy's, lazy collections and > PersistentEnum types, so i don't have to write & maintain the toString > methods (for this purpose) anymore. i know gavin would rather the Session > interface didn't grow anymore :-), but i think this may be useful for others > to. > > comments? > > brad > > > > ------------------------------------------------------- > This sf.net email is sponsored by: DEDICATED SERVERS only $89! > Linux or FreeBSD, FREE setup, FAST network. Get your own server > today at http://www.ServePath.com/indexfm.htm > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Anton v. S. <an...@ap...> - 2002-10-01 22:39:53
|
I would find this useful. I rely on toString quite a bit. I assume that printToString could be added somewhere else, but would then require a session object as a parameter? Or would that be very unnatural? Design niceties aside, that would work fine for me. Would adding it to the Hibernate class be any better from a reduced-interface-clutter perspective? Anton -----Original Message----- From: hib...@li... [mailto:hib...@li...]On Behalf Of Brad Clow Sent: Tuesday, October 01, 2002 5:43 PM To: hib...@li... Subject: [Hibernate] writing the properties of a persistent object to a string i often add a toString method (that prints out the values of all properties) to my persistent objects so that i can get detailed logging of an object's state when it is loaded, saved, etc. i have just written a printToString method for the Session interface/SessionImpl class that does this dynamically, taking into account proxy's, lazy collections and PersistentEnum types, so i don't have to write & maintain the toString methods (for this purpose) anymore. i know gavin would rather the Session interface didn't grow anymore :-), but i think this may be useful for others to. comments? brad |
From: Brad C. <bra...@wo...> - 2002-10-01 21:44:06
|
i often add a toString method (that prints out the values of all = properties) to my persistent objects so that i can get detailed logging = of an object's state when it is loaded, saved, etc. i have just written = a printToString method for the Session interface/SessionImpl class that = does this dynamically, taking into account proxy's, lazy collections and = PersistentEnum types, so i don't have to write & maintain the toString = methods (for this purpose) anymore. i know gavin would rather the = Session interface didn't grow anymore :-), but i think this may be = useful for others to. comments? brad |
From: Gavin K. <ga...@ap...> - 2002-10-01 05:18:26
|
In your environment, is no-wait something you use every time you select from a table, or is it something that is used very occasionally? What I mean is; is it enough to have a system property hibernate.locking.use_no_wait or mapping file option, <class name="Foo" no-wait="true"> or should I have a new LockMode LockMode.EXCLUSIVE_NO_WAIT ----- Original Message ----- From: "Paul Szego" <pau...@ne...> To: "Gavin King" <ga...@ap...> Sent: Tuesday, October 01, 2002 3:04 PM Subject: Re: [Hibernate] What would a good locking API look like? > > Hi, > > a no-wait option would be useful. It's what's stopping us using this in > a few productions sytems. I hacked this in quite a while back, but the > codebase has moved on considerably. > > Session.lock(foo) == Session.lock(foo, LockMode.EXCLUSIVE) > == Session.lock(foo, LockMode.EXCLUSIVE, WaitMode.WAIT) > == Session.lock(foo, WaitMode.WAIT) > > with an alternative of WaitMode.NOWAIT, or just use a boolean if you're > that way inclined. > > PaulS. > > Gavin King wrote: > > Hi, I've been thinking about improving Hibernate's locking API recently. > > Currently your object could be in 3 different states: > > > > * No lock, for example if you just called session.update(foo) or if the > > session was disconnected > > * Shared lock, for example if you just called session.load(id) or > > session.find(query) > > * Exclusive lock, if you called session.loadWithLock(id) or > > session.lock(foo), or if changes to the object have been flush()ed > > > > There is currently no mechanism for upgrading a lock from No lock to Shared > > lock, ie. to do a version check for an object. > > > > So I'm wondering about deprecating Session.lock() and Session.loadWithLock() > > and replacing them with > > > > Session.load(clazz, id, lockMode) > > Session.load(object, id, lockMode) > > Session.lock(object, lockMode) > > > > I would introduce a new class, > > > > public class LockMode { > > public static final LockMode NONE; > > public static final LockMode SHARED; > > public static final LockMode EXCLUSIVE; > > } > > > > Then > > > > Session.loadWithLock(clazz, id) == Session.load(clazz, id, > > LockMode.EXCLUSIVE) > > Session.lock(foo) == Session.lock(foo, LockMode.EXCLUSIVE) > > > > There is also a certain argument for allowing Session.update(foo, lockMode), > > but thats a bit more difficult to implement, so lets leave it for later.... > > > > Ideas + criticisms are very welcome! > > > > Gavin > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by: DEDICATED SERVERS only $89! > > Linux or FreeBSD, FREE setup, FAST network. Get your own server > > today at http://www.ServePath.com/indexfm.htm > > _______________________________________________ > > hibernate-devel mailing list > > hib...@li... > > https://lists.sourceforge.net/lists/listinfo/hibernate-devel > > > > > |
From: Gavin K. <ga...@ap...> - 2002-10-01 04:50:47
|
Hi, I've been thinking about improving Hibernate's locking API recently. Currently your object could be in 3 different states: * No lock, for example if you just called session.update(foo) or if the session was disconnected * Shared lock, for example if you just called session.load(id) or session.find(query) * Exclusive lock, if you called session.loadWithLock(id) or session.lock(foo), or if changes to the object have been flush()ed There is currently no mechanism for upgrading a lock from No lock to Shared lock, ie. to do a version check for an object. So I'm wondering about deprecating Session.lock() and Session.loadWithLock() and replacing them with Session.load(clazz, id, lockMode) Session.load(object, id, lockMode) Session.lock(object, lockMode) I would introduce a new class, public class LockMode { public static final LockMode NONE; public static final LockMode SHARED; public static final LockMode EXCLUSIVE; } Then Session.loadWithLock(clazz, id) == Session.load(clazz, id, LockMode.EXCLUSIVE) Session.lock(foo) == Session.lock(foo, LockMode.EXCLUSIVE) There is also a certain argument for allowing Session.update(foo, lockMode), but thats a bit more difficult to implement, so lets leave it for later.... Ideas + criticisms are very welcome! Gavin |
From: Gavin K. <ga...@ap...> - 2002-10-01 03:37:29
|
Put it in the patch manager if you like.... THanks Gavin ----- Original Message ----- From: "Chris Winters" <cwi...@op...> To: <hib...@li...> Sent: Tuesday, October 01, 2002 12:42 PM Subject: [Hibernate] patch to cirrus.hibernate.jmx.HibernateService > I have a patch to cirrus.hibernate.jmx.HibernateService to make > subclassing easier. (In particular, it just changes all references to > the mapping resources to method calls rather than direct variable > accesses so that a subclass can define a different way to get the > mapping files.) > > Should I submit it to the Sourceforge patch manager, the mailing list, > or...? > > Thanks, > > Chris > > -- > Chris Winters (cwi...@op...) > Java Developer > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Chris W. <cwi...@op...> - 2002-10-01 02:28:02
|
I have a patch to cirrus.hibernate.jmx.HibernateService to make subclassing easier. (In particular, it just changes all references to the mapping resources to method calls rather than direct variable accesses so that a subclass can define a different way to get the mapping files.) Should I submit it to the Sourceforge patch manager, the mailing list, or...? Thanks, Chris -- Chris Winters (cwi...@op...) Java Developer |
From: Boring, J. W, A. <jb...@at...> - 2002-09-30 18:40:18
|
> You create a local variable myS that hides the instance variable < Sorry about that. This cold I've got has turned me into a space cadet. Jeff Boring Custom & Web Services Development AT&T Labs jb...@at... (813) 878-3367 |
From: Gavin K. <ga...@ap...> - 2002-09-30 18:23:23
|
You create a local variable myS that hides the instance variable > Session myS = sf.openSession(); should be myS = sf.openSession(); ----- Original Message ----- From: "Boring, Jeff W, ALBAS" <jb...@at...> To: "Gavin King" <ga...@ap...>; <hib...@li...> Sent: Tuesday, October 01, 2002 4:15 AM Subject: RE: [Hibernate] NullPointerException on Session.find > >Nothing obviously wrong in what you have given so far.< > > That's good news. At least I'm not totally off track! > > > you will have to show a bit more code than that....< > > here it is: > > public class JWBDemo { > > private static SessionFactory sf; > private static Datastore ds; > private static Session myS; > > public static void main( String[] no_args ) throws Exception { > > ds = Hibernate.createDatastore() > .storeClass(Edge.class) > .storeClass(Vertex.class) > .storeClass(Department.class); > > sf = ds.buildSessionFactory(); > Session myS = sf.openSession(); > doDept(); > } > > public static void doDept() throws Exception { > > String name = null; > List depts = null; > Department aDept = null; > String Id = new String ("A00"); > > try { > depts = myS.find( > "from Department in class boring.sandbox.Department" ); > Iterator it = depts.iterator(); > aDept = (Department) it.next(); > name = aDept.getName(); > System.out.println(aDept); > } > catch (Exception e){ > e.printStackTrace(); > } > } > > -----Original Message----- > From: Gavin King [mailto:ga...@ap...] > Sent: Monday, September 30, 2002 2:12 PM > To: Boring, Jeff W, ALBAS; hib...@li... > Subject: Re: [Hibernate] NullPointerException on Session.find > > > Hmmmm. not sure. you will have to show a bit more code than that.... > > Nothing obviously wrong in what you have given so far. > > ----- Original Message ----- > From: "Boring, Jeff W, ALBAS" <jb...@at...> > To: <hib...@li...> > Sent: Tuesday, October 01, 2002 3:58 AM > Subject: [Hibernate] NullPointerException on Session.find > > > > Help!!!! > > > > Newbie here trying some basic code and getting a nullpointer on the find. > I know it is something stupid I'm doing. Thanks for any help. > > > > Code is: > > > > depts = myS.find("from Department in class boring.sandbox.Department" ); > > > > ---------------------- console ---------------------- > > [INFO] DatastoreImpl - -Mapping resource: cirrus/hibernate/eg/Edge.hbm.xml > > [INFO] XMLHelper - -Parsing XML: unknown system id > > [INFO] DatastoreImpl - -Mapping resource: > cirrus/hibernate/eg/Vertex.hbm.xml > > [INFO] XMLHelper - -Parsing XML: unknown system id > > [INFO] Environment - -loaded properties from resource hibernate.properties > > [INFO] Environment - -echoing all SQL to stdout > > [INFO] Environment - -using java.io streams to persist binary types > > [INFO] Environment - -JVM proxy support: true > > [WARN] Collection - -Attribute "order-by" ignored in JDK1.3 or less > > [WARN] Collection - -Attribute "order-by" ignored in JDK1.3 or less > > [INFO] DatastoreImpl - -Mapping resource: > boring/sandbox/Department.hbm.xml > > [INFO] XMLHelper - -Parsing XML: unknown system id > > [INFO] Dialect - -Using dialect: class cirrus.hibernate.sql.DB2Dialect > > [INFO] DriverManagerConnectionProvider - -Hibernate connection pool size: > 2 > > [INFO] DriverManagerConnectionProvider - -Using driver: > COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2:sample > > [INFO] DriverManagerConnectionProvider - -Connection properties: > {user=hibernate, password=thisIsStupid!} > > [INFO] PreparedStatementCache - -prepared statement cache size: 100 > > [INFO] SessionFactoryImpl - -Use outer join fetching: true > > [INFO] SessionFactoryImpl - -Use scrollable result sets: true > > [INFO] SessionFactoryImpl - -Use JDBC 2 batch updates: false > > [WARN] SessionFactoryObjectFactory - -no JDNI name configured > > [INFO] SessionFactoryImpl - -Query language substitutions: {false=0, > no='N', yes='Y', true=1} > > [INFO] SessionFactoryImpl - -Query language imports: cirrus.hibernate.test > > java.lang.NullPointerException > > at boring.sandbox.JWBDemo.doDept(JWBDemo.java:50) > > at boring.sandbox.JWBDemo.main(JWBDemo.java:38) > > ---------------------- console ---------------------- > > ---------------------- Department.java ---------------------- > > package boring.sandbox; > > public class Department { > > private String name = null; > > private String number = null; > > private String location = null; > > > > public void Department(){ > > } > > > > public String getName(){ > > return name; > > } > > public String getNumber(){ > > return number; > > } > > public String getLocation(){ > > return location; > > } > > public void setName (String parm){ > > name = parm; > > } > > public void setNumber (String parm){ > > number = parm; > > } > > public void setLocation (String parm){ > > location = parm; > > } > > } > > ---------------------- Department.java ---------------------- > > > > ---------------------- DB Table DDL ---------------------- > > CREATE TABLE "DB2ADMIN"."DEPARTMENT" ( > > "DEPTNO" CHAR(3) NOT NULL , > > "DEPTNAME" VARCHAR(29) NOT NULL , > > "MGRNO" CHAR(6) , > > "ADMRDEPT" CHAR(3) NOT NULL , > > "LOCATION" CHAR(16) ) > > IN "USERSPACE1" ; > > > > ALTER TABLE "DB2ADMIN"."DEPARTMENT" > > ADD CONSTRAINT "PKEY" PRIMARY KEY > > ("DEPTNO"); > > ---------------------- DB Table DDL ---------------------- > > > > ---------------------- Department.hbn.xml ---------------------- > > <?xml version="1.0"?> > > <!DOCTYPE hibernate-mapping PUBLIC > > "-//Hibernate/Hibernate Mapping DTD//EN" > > "http://hibernate.sourceforge.net/hibernate-mapping.dtd"> > > > > <hibernate-mapping> > > > > <class name="boring.sandbox.Department" table="department" > schema="db2admin"> > > > > <!-- comment --> > > <id column="DEPTNO" name="number" type="string"> > > <generator class="assigned"/> > > </id> > > > > <property name="name" column="DEPTNAME" type="string" /> > > <property name="location" column="LOCATION" type="string" /> > > > > </class> > > > > </hibernate-mapping> > > ---------------------- Department.hbn.xml ---------------------- > > > > Jeff Boring > > Custom & Web Services Development > > AT&T Labs > > jb...@at... > > (813) 878-3367 > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > hibernate-devel mailing list > > hib...@li... > > 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 > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Boring, J. W, A. <jb...@at...> - 2002-09-30 18:15:56
|
>Nothing obviously wrong in what you have given so far.<=20 That's good news. At least I'm not totally off track! > you will have to show a bit more code than that....< here it is: public class JWBDemo { =09 private static SessionFactory sf; private static Datastore ds; private static Session myS; public static void main( String[] no_args ) throws Exception { =09 ds =3D Hibernate.createDatastore() .storeClass(Edge.class) .storeClass(Vertex.class) .storeClass(Department.class); =09 sf =3D ds.buildSessionFactory(); Session myS =3D sf.openSession(); doDept(); =09 } =09 public static void doDept() throws Exception { =09 String name =3D null; List depts =3D null; Department aDept =3D null; String Id =3D new String ("A00"); =09 try { depts =3D myS.find( "from Department in class boring.sandbox.Department" ); Iterator it =3D depts.iterator(); aDept =3D (Department) it.next(); name =3D aDept.getName(); System.out.println(aDept); } catch (Exception e){ e.printStackTrace(); }=09 } -----Original Message----- From: Gavin King [mailto:ga...@ap...] Sent: Monday, September 30, 2002 2:12 PM To: Boring, Jeff W, ALBAS; hib...@li... Subject: Re: [Hibernate] NullPointerException on Session.find Hmmmm. not sure. you will have to show a bit more code than that.... Nothing obviously wrong in what you have given so far. ----- Original Message ----- From: "Boring, Jeff W, ALBAS" <jb...@at...> To: <hib...@li...> Sent: Tuesday, October 01, 2002 3:58 AM Subject: [Hibernate] NullPointerException on Session.find > Help!!!! > > Newbie here trying some basic code and getting a nullpointer on the = find. I know it is something stupid I'm doing. Thanks for any help. > > Code is: > > depts =3D myS.find("from Department in class = boring.sandbox.Department" ); > > ---------------------- console ---------------------- > [INFO] DatastoreImpl - -Mapping resource: = cirrus/hibernate/eg/Edge.hbm.xml > [INFO] XMLHelper - -Parsing XML: unknown system id > [INFO] DatastoreImpl - -Mapping resource: cirrus/hibernate/eg/Vertex.hbm.xml > [INFO] XMLHelper - -Parsing XML: unknown system id > [INFO] Environment - -loaded properties from resource = hibernate.properties > [INFO] Environment - -echoing all SQL to stdout > [INFO] Environment - -using java.io streams to persist binary types > [INFO] Environment - -JVM proxy support: true > [WARN] Collection - -Attribute "order-by" ignored in JDK1.3 or less > [WARN] Collection - -Attribute "order-by" ignored in JDK1.3 or less > [INFO] DatastoreImpl - -Mapping resource: boring/sandbox/Department.hbm.xml > [INFO] XMLHelper - -Parsing XML: unknown system id > [INFO] Dialect - -Using dialect: class cirrus.hibernate.sql.DB2Dialect > [INFO] DriverManagerConnectionProvider - -Hibernate connection pool = size: 2 > [INFO] DriverManagerConnectionProvider - -Using driver: COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2:sample > [INFO] DriverManagerConnectionProvider - -Connection properties: {user=3Dhibernate, password=3DthisIsStupid!} > [INFO] PreparedStatementCache - -prepared statement cache size: 100 > [INFO] SessionFactoryImpl - -Use outer join fetching: true > [INFO] SessionFactoryImpl - -Use scrollable result sets: true > [INFO] SessionFactoryImpl - -Use JDBC 2 batch updates: false > [WARN] SessionFactoryObjectFactory - -no JDNI name configured > [INFO] SessionFactoryImpl - -Query language substitutions: {false=3D0, no=3D'N', yes=3D'Y', true=3D1} > [INFO] SessionFactoryImpl - -Query language imports: = cirrus.hibernate.test > java.lang.NullPointerException > at boring.sandbox.JWBDemo.doDept(JWBDemo.java:50) > at boring.sandbox.JWBDemo.main(JWBDemo.java:38) > ---------------------- console ---------------------- > ---------------------- Department.java ---------------------- > package boring.sandbox; > public class Department { > private String name =3D null; > private String number =3D null; > private String location =3D null; > > public void Department(){ > } > > public String getName(){ > return name; > } > public String getNumber(){ > return number; > } > public String getLocation(){ > return location; > } > public void setName (String parm){ > name =3D parm; > } > public void setNumber (String parm){ > number =3D parm; > } > public void setLocation (String parm){ > location =3D parm; > } > } > ---------------------- Department.java ---------------------- > > ---------------------- DB Table DDL ---------------------- > CREATE TABLE "DB2ADMIN"."DEPARTMENT" ( > "DEPTNO" CHAR(3) NOT NULL , > "DEPTNAME" VARCHAR(29) NOT NULL , > "MGRNO" CHAR(6) , > "ADMRDEPT" CHAR(3) NOT NULL , > "LOCATION" CHAR(16) ) > IN "USERSPACE1" ; > > ALTER TABLE "DB2ADMIN"."DEPARTMENT" > ADD CONSTRAINT "PKEY" PRIMARY KEY > ("DEPTNO"); > ---------------------- DB Table DDL ---------------------- > > ---------------------- Department.hbn.xml ---------------------- > <?xml version=3D"1.0"?> > <!DOCTYPE hibernate-mapping PUBLIC > "-//Hibernate/Hibernate Mapping DTD//EN" > "http://hibernate.sourceforge.net/hibernate-mapping.dtd"> > > <hibernate-mapping> > > <class name=3D"boring.sandbox.Department" table=3D"department" schema=3D"db2admin"> > > <!-- comment --> > <id column=3D"DEPTNO" name=3D"number" type=3D"string"> > <generator class=3D"assigned"/> > </id> > > <property name=3D"name" column=3D"DEPTNAME" type=3D"string" /> > <property name=3D"location" column=3D"LOCATION" type=3D"string" /> > > </class> > > </hibernate-mapping> > ---------------------- Department.hbn.xml ---------------------- > > Jeff Boring > Custom & Web Services Development > AT&T Labs > jb...@at... > (813) 878-3367 > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Gavin K. <ga...@ap...> - 2002-09-30 18:11:46
|
Hmmmm. not sure. you will have to show a bit more code than that.... Nothing obviously wrong in what you have given so far. ----- Original Message ----- From: "Boring, Jeff W, ALBAS" <jb...@at...> To: <hib...@li...> Sent: Tuesday, October 01, 2002 3:58 AM Subject: [Hibernate] NullPointerException on Session.find > Help!!!! > > Newbie here trying some basic code and getting a nullpointer on the find. I know it is something stupid I'm doing. Thanks for any help. > > Code is: > > depts = myS.find("from Department in class boring.sandbox.Department" ); > > ---------------------- console ---------------------- > [INFO] DatastoreImpl - -Mapping resource: cirrus/hibernate/eg/Edge.hbm.xml > [INFO] XMLHelper - -Parsing XML: unknown system id > [INFO] DatastoreImpl - -Mapping resource: cirrus/hibernate/eg/Vertex.hbm.xml > [INFO] XMLHelper - -Parsing XML: unknown system id > [INFO] Environment - -loaded properties from resource hibernate.properties > [INFO] Environment - -echoing all SQL to stdout > [INFO] Environment - -using java.io streams to persist binary types > [INFO] Environment - -JVM proxy support: true > [WARN] Collection - -Attribute "order-by" ignored in JDK1.3 or less > [WARN] Collection - -Attribute "order-by" ignored in JDK1.3 or less > [INFO] DatastoreImpl - -Mapping resource: boring/sandbox/Department.hbm.xml > [INFO] XMLHelper - -Parsing XML: unknown system id > [INFO] Dialect - -Using dialect: class cirrus.hibernate.sql.DB2Dialect > [INFO] DriverManagerConnectionProvider - -Hibernate connection pool size: 2 > [INFO] DriverManagerConnectionProvider - -Using driver: COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2:sample > [INFO] DriverManagerConnectionProvider - -Connection properties: {user=hibernate, password=thisIsStupid!} > [INFO] PreparedStatementCache - -prepared statement cache size: 100 > [INFO] SessionFactoryImpl - -Use outer join fetching: true > [INFO] SessionFactoryImpl - -Use scrollable result sets: true > [INFO] SessionFactoryImpl - -Use JDBC 2 batch updates: false > [WARN] SessionFactoryObjectFactory - -no JDNI name configured > [INFO] SessionFactoryImpl - -Query language substitutions: {false=0, no='N', yes='Y', true=1} > [INFO] SessionFactoryImpl - -Query language imports: cirrus.hibernate.test > java.lang.NullPointerException > at boring.sandbox.JWBDemo.doDept(JWBDemo.java:50) > at boring.sandbox.JWBDemo.main(JWBDemo.java:38) > ---------------------- console ---------------------- > ---------------------- Department.java ---------------------- > package boring.sandbox; > public class Department { > private String name = null; > private String number = null; > private String location = null; > > public void Department(){ > } > > public String getName(){ > return name; > } > public String getNumber(){ > return number; > } > public String getLocation(){ > return location; > } > public void setName (String parm){ > name = parm; > } > public void setNumber (String parm){ > number = parm; > } > public void setLocation (String parm){ > location = parm; > } > } > ---------------------- Department.java ---------------------- > > ---------------------- DB Table DDL ---------------------- > CREATE TABLE "DB2ADMIN"."DEPARTMENT" ( > "DEPTNO" CHAR(3) NOT NULL , > "DEPTNAME" VARCHAR(29) NOT NULL , > "MGRNO" CHAR(6) , > "ADMRDEPT" CHAR(3) NOT NULL , > "LOCATION" CHAR(16) ) > IN "USERSPACE1" ; > > ALTER TABLE "DB2ADMIN"."DEPARTMENT" > ADD CONSTRAINT "PKEY" PRIMARY KEY > ("DEPTNO"); > ---------------------- DB Table DDL ---------------------- > > ---------------------- Department.hbn.xml ---------------------- > <?xml version="1.0"?> > <!DOCTYPE hibernate-mapping PUBLIC > "-//Hibernate/Hibernate Mapping DTD//EN" > "http://hibernate.sourceforge.net/hibernate-mapping.dtd"> > > <hibernate-mapping> > > <class name="boring.sandbox.Department" table="department" schema="db2admin"> > > <!-- comment --> > <id column="DEPTNO" name="number" type="string"> > <generator class="assigned"/> > </id> > > <property name="name" column="DEPTNAME" type="string" /> > <property name="location" column="LOCATION" type="string" /> > > </class> > > </hibernate-mapping> > ---------------------- Department.hbn.xml ---------------------- > > Jeff Boring > Custom & Web Services Development > AT&T Labs > jb...@at... > (813) 878-3367 > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > hibernate-devel mailing list > hib...@li... > https://lists.sourceforge.net/lists/listinfo/hibernate-devel |
From: Boring, J. W, A. <jb...@at...> - 2002-09-30 17:59:06
|
Help!!!! Newbie here trying some basic code and getting a nullpointer on the = find. I know it is something stupid I'm doing. Thanks for any help. Code is: depts =3D myS.find("from Department in class boring.sandbox.Department" = ); ---------------------- console ---------------------- [INFO] DatastoreImpl - -Mapping resource: = cirrus/hibernate/eg/Edge.hbm.xml [INFO] XMLHelper - -Parsing XML: unknown system id [INFO] DatastoreImpl - -Mapping resource: = cirrus/hibernate/eg/Vertex.hbm.xml [INFO] XMLHelper - -Parsing XML: unknown system id [INFO] Environment - -loaded properties from resource = hibernate.properties [INFO] Environment - -echoing all SQL to stdout [INFO] Environment - -using java.io streams to persist binary types [INFO] Environment - -JVM proxy support: true [WARN] Collection - -Attribute "order-by" ignored in JDK1.3 or less [WARN] Collection - -Attribute "order-by" ignored in JDK1.3 or less [INFO] DatastoreImpl - -Mapping resource: = boring/sandbox/Department.hbm.xml [INFO] XMLHelper - -Parsing XML: unknown system id [INFO] Dialect - -Using dialect: class cirrus.hibernate.sql.DB2Dialect [INFO] DriverManagerConnectionProvider - -Hibernate connection pool = size: 2 [INFO] DriverManagerConnectionProvider - -Using driver: = COM.ibm.db2.jdbc.app.DB2Driver at URL: jdbc:db2:sample [INFO] DriverManagerConnectionProvider - -Connection properties: = {user=3Dhibernate, password=3DthisIsStupid!} [INFO] PreparedStatementCache - -prepared statement cache size: 100 [INFO] SessionFactoryImpl - -Use outer join fetching: true [INFO] SessionFactoryImpl - -Use scrollable result sets: true [INFO] SessionFactoryImpl - -Use JDBC 2 batch updates: false [WARN] SessionFactoryObjectFactory - -no JDNI name configured [INFO] SessionFactoryImpl - -Query language substitutions: {false=3D0, = no=3D'N', yes=3D'Y', true=3D1} [INFO] SessionFactoryImpl - -Query language imports: = cirrus.hibernate.test java.lang.NullPointerException at boring.sandbox.JWBDemo.doDept(JWBDemo.java:50) at boring.sandbox.JWBDemo.main(JWBDemo.java:38) ---------------------- console ---------------------- ---------------------- Department.java ---------------------- package boring.sandbox; public class Department { private String name =3D null; private String number =3D null; private String location =3D null; public void Department(){ } =09 =09 public String getName(){ return name; }=09 public String getNumber(){ return number; } =09 public String getLocation(){ return location; } =09 public void setName (String parm){ name =3D parm; } public void setNumber (String parm){ number =3D parm; } public void setLocation (String parm){ location =3D parm; } } ---------------------- Department.java ---------------------- ---------------------- DB Table DDL ---------------------- CREATE TABLE "DB2ADMIN"."DEPARTMENT" ( "DEPTNO" CHAR(3) NOT NULL ,=20 "DEPTNAME" VARCHAR(29) NOT NULL ,=20 "MGRNO" CHAR(6) ,=20 "ADMRDEPT" CHAR(3) NOT NULL ,=20 "LOCATION" CHAR(16) ) =20 IN "USERSPACE1" ;=20 ALTER TABLE "DB2ADMIN"."DEPARTMENT"=20 ADD CONSTRAINT "PKEY" PRIMARY KEY ("DEPTNO"); ---------------------- DB Table DDL ---------------------- ---------------------- Department.hbn.xml ---------------------- <?xml version=3D"1.0"?> <!DOCTYPE hibernate-mapping PUBLIC=20 "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping.dtd"> <hibernate-mapping> <class name=3D"boring.sandbox.Department" table=3D"department" = schema=3D"db2admin"> =20 <!-- comment --> <id column=3D"DEPTNO" name=3D"number" type=3D"string"> <generator class=3D"assigned"/> </id> =20 <property name=3D"name" column=3D"DEPTNAME" type=3D"string" /> <property name=3D"location" column=3D"LOCATION" type=3D"string" /> =20 </class> =20 </hibernate-mapping> ---------------------- Department.hbn.xml ---------------------- Jeff Boring Custom & Web Services Development AT&T Labs jb...@at... (813) 878-3367 |
From: Andrea A. <aa...@li...> - 2002-09-30 07:47:06
|
Gavin King wrote: >>- sets miss then not-null attribute, so I cannot judge if >> they are to be included in the minimal constructor or not >> >> > >I *think* its reasonable to actually create a HashSet, ArrayList, etc >in the minimal constructor. > ... >Yes, of course; I think its a very useful addition.How would you like to >send the code? Is the Sourceforge patch manager the easiest way for you? > >Gavin > > I will check out the current cvs and find a way to create the patch, then post on the sf patch manager... Best regards Andrea Aime |
From: Andrea A. <aa...@li...> - 2002-09-30 07:44:42
|
Gavin King wrote: >>Basically, there are two problems: >>- the same foreign key is generated two times (artplFK1, artplFK2) >> >> > >That won't happen if you declare one end of the bidirectional association >with readonly="true" which is the preferred style. > > Ah, I see. But if I allow editing on both sides, what can go wrong? I mean, either the programmer should not be allowed to mark both sides as editable or the fk should not be generated two times... I will have a look at the code and see if we can avoid this... >Yeah, I know.....I didn't quite know what to do about NUMERIC types....we >really should allow precision and scale attributes as well as length, but >that is starting to complicate the DTD too much. What we will probably have >to do eventually is allow them on the <column> element rather than the ><property> elements, etc. However, you can already do this: > ><property name="cost" type="big_decimal"> > <column sql-type="NUMERIC(19,2)"/> ></property> > > > Yes, but this would be database specific, would work with Postgres but not with SAPDB, Oracle... One of the greatest features of the mapping file is that it is database agnonistc, using the sql-type attribute you lose this feature... >Which is actually less typing than: > ><property name="cost" type="big_decimal"> > <column precision="19" scale="2"> ></property> > >So I couldn't be bothered with that just yet. > >If you are voluteering to fix this stuff, your help is very welcome ;) > >Gavin > > > My proposal is to add precision and scale as column attributes and default to (19,2) which seems to me the most reasonable default, since that would treat all databases in an uniform way. The numeric default type is allowed to grow to the implementation limits, that is, a very big size I guess, which means a very big space overhead on the disk, or to a non uniform treatment of the data contained in the column (like a BLOB type), which may be very slow. If one needs the NUMERIC without precision and scale specification he is asking for a PostgreSQL specific feature, so it would be reasonable to use the sql-type directly. If you agree I can have a look at the implementation... Best regards Andrea Aime |
From: Gavin K. <ga...@ap...> - 2002-09-30 04:21:08
|
I'm really happy with the recent changes I've done to make Hibernate more extensible and more understandable. *Finally* the SessionImpl class is starting to get smaller instead of bigger... The main points of redesign: * pulled all querying and loading functionality out of SessionImpl into the Loader heirarchy * abstracted ClassPersister to allow pluggable persistence mechanisms * replaced the "deferred loading" feature with a new "2-phase load" * simplified versioning (which had actually been broken) The third point (which I implemented last night) is to do with processing an SQL ResultSet when objects contained earlier in the ResultSet might have associations to objects later in the ResultSet. Hibernate used to deal with this using a variant of the flyweight pattern where it would instantiate the associated object but not actually try to initialize it till after the ResultSet was fully processed. If it happened to find the object later in the ResultSet, it would initialize it then. The disadvantages of this approach were: 1. It couldn't work for polymorphic classes (we need to know the exact subclass of the associated object to instantiate it) 2. It turned out to be horrendously complicated and bug-inducing The new approach is to load objects in two phases phase 1: (while processing the ResultSet) instantiate objects and grab their state into an array, representing associations with an identifier phase 2: (after the ResultSet is finished) resolve identifiers into the associated objects and then initialize the object This has one extra advantage in addition to 1 + 2 no longer applying 3. We don't need to use concurrent open ResultSets It turns out that this approach is *much* simpler and better and I'm embarrassed for not realizing that fact earlier (I knew that it existed as an alternative!) I got rid of some of the most difficult code in SessionImpl and removed about 3 instance variables. P.S. I am already working on multi-table persistence for those who need it.... |
From: Gavin K. <ga...@ap...> - 2002-09-30 03:33:43
|
> - sets miss then not-null attribute, so I cannot judge if > they are to be included in the minimal constructor or not I *think* its reasonable to actually create a HashSet, ArrayList, etc in the minimal constructor. > (the not-null attribute should be added to set, bag, ...) Hmmmm I'm not willing to do this, because the not-null attribute implies the existence of a constraint in the relational model. > - of course I'm not willing to maintain this pach-set outside > the CVS, so I will develop it further only if you like the > idea and are willing to accept my work... (the patch is > very small but it's annoying to keep it on par every time > a new hibernate release is out) Yes, of course; I think its a very useful addition.How would you like to send the code? Is the Sourceforge patch manager the easiest way for you? Gavin |
From: Gavin K. <ga...@ap...> - 2002-09-30 03:19:25
|
> Basically, there are two problems: > - the same foreign key is generated two times (artplFK1, artplFK2) That won't happen if you declare one end of the bidirectional association with readonly="true" which is the preferred style. > - big_decimal is mapped to a NUMERIC... according to the Postgres > documentation "NUMERIC without any precision or scale creates a column in > which numeric values of any precision and scale can be stored, up to > the implementation limit on precision." That seems to be a little overkill > to me, moreover I've specified a length=2, so I expect something like > NUMERIC(x,2) (SAPDB dialect outputs FIXED(19,2)) Yeah, I know.....I didn't quite know what to do about NUMERIC types....we really should allow precision and scale attributes as well as length, but that is starting to complicate the DTD too much. What we will probably have to do eventually is allow them on the <column> element rather than the <property> elements, etc. However, you can already do this: <property name="cost" type="big_decimal"> <column sql-type="NUMERIC(19,2)"/> </property> Which is actually less typing than: <property name="cost" type="big_decimal"> <column precision="19" scale="2"> </property> So I couldn't be bothered with that just yet. Still, I know its suboptimal. The reason for the inconsistency between dialects is I would have preferred to handle it like Postgres for all dialects, but most of the databases default scale to 0, which is useless. If you are voluteering to fix this stuff, your help is very welcome ;) Gavin |
From: Andrea A. <aa...@li...> - 2002-09-29 20:44:53
|
Looking at code generation output I feel I miss a couple of=20 constructors, one with the full set of properties, one with only the non-null properties, that can be used to create a=20 new bean without using all the setters. Both constructors should not contain the id in case it is generated by the framework. Sitting on my disk I have an half baked patch that creates those constructors, but I still have some=20 problems: =2D sets miss then not-null attribute, so I cannot judge if they are to be included in the minimal constructor or not (the not-null attribute should be added to set, bag, ...) =2D of course I'm not willing to maintain this pach-set outside the CVS, so I will develop it further only if you like the idea and are willing to accept my work... (the patch is very small but it's annoying to keep it on par every time a new hibernate release is out) What do you think? Best regards Andrea Aime |
From: Andrea A. <aa...@li...> - 2002-09-29 20:44:51
|
Hi everybody, please have a look at the following files, a mapping file and the=20 sql generated by Hibernate tools.=20 =2D------------------------------------------------------------------------= =2D--------------------------- <?xml version=3D"1.0"?> <!DOCTYPE hibernate-mapping SYSTEM "hibernate-mapping.dtd"> <hibernate-mapping> <class name=3D"Article" table=3D"article"> <id name=3D"id" column=3D"id" type=3D"long"> <generator class=3D"vm.long"/> </id> <property name=3D"description" type=3D"string" length=3D"75" not-null= =3D"true"/> <property name=3D"cost" type=3D"big_decimal" length=3D"2"/> </class> =20 <class name=3D"PriceList" table=3D"pricelist"> <id name=3D"id" column=3D"id" type=3D"long"> <generator class=3D"vm.long"/> </id> <set role=3D"righeArticolo"> <key type=3D"long" column=3D"plid"/> <one-to-many class=3D"ArticlePL"/> </set> </class> =20 <class name=3D"ArticlePL" table=3D"artpl"> <id name=3D"id" column=3D"id" type=3D"long"> <generator class=3D"vm.long"/> </id> <property name=3D"discount" type=3D"float" column=3D"discount" not-null= =3D"true"/> <many-to-one name=3D"article" column=3D"articleid"=20 class=3D"Article"/> <many-to-one name=3D"pl" column=3D"plid"=20 class=3D"PriceList"/> </class> =20 </hibernate-mapping> =2D------------------------------------------------------------------------= =2D----------------------------- drop table artpl drop table pricelist drop table article create table artpl (articleid INT8, discount FLOAT4 not null, id INT8 not=20 null, plid INT8, primary key (id)) create table pricelist (id INT8 not null, primary key (id)) create table article (cost NUMERIC, description VARCHAR(75) not null, id IN= T8=20 not null, primary key (id)) alter table artpl add constraint artplFK1 foreign key (plid) references=20 pricelist alter table artpl add constraint artplFK0 foreign key (articleid) reference= s=20 article alter table artpl add constraint artplFK2 foreign key (plid) references=20 pricelist create index artplIDX3 on artpl (plid) =2D------------------------------------------------------------------------= =2D---------------------------- Basically, there are two problems: =2D the same foreign key is generated two times (artplFK1, artplFK2) =2D big_decimal is mapped to a NUMERIC... according to the Postgres =20 documentation "NUMERIC without any precision or scale creates a column in which numeric values of any precision and scale can be stored, up to the implementation limit on precision." That seems to be a little overki= ll=20 to me, moreover I've specified a length=3D2, so I expect something like NUMERIC(x,2) (SAPDB dialect outputs FIXED(19,2)) Comments are welcome... :-) Best regards Andrea Aime |