Re: [Hibernate] [Maybe OT] odmg.jar licence
On 27 Oct (15:48), [EMAIL PROTECTED] wrote: > does anybody know the exact licensing terms of the odmg.jar file? I was > unable to find anything mentioning something about it. http://forum.hibernate.org/viewtopic.php?t=924813 -- Christian Bauer [EMAIL PROTECTED] --- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
[Hibernate] one to one relationship Hiberbate 2.0.3 MySQL 4.0.14b not working
Hi Guys, Environment: Hibernate 2.0.3, MySQL 4.0.14b, Windows 2K. have many-to-many, many-to-one, and one-to-many working like a charm. struggling with enforcing the same key for a one-to-one. example user.hbm.xml: example address.hbm.xml: when I create an address object for a specific user, it has a different id than the user's id: 2 trying to enforce with something like addr.setId(user.getId()); does not work, still the address has an id of 65537 for example, so the delete of a user has no impact on the address. Is something wrong in the hbm.xml? does somebody have a working example of the one-to-one relationship? Thanks, Mike
[Hibernate] Business Rules
Hi all, Please, take a look at the the following scenario: A "Order" persistence class is associate to a "Customer" persistence class and the business rules is: We can not make a new Order if the Customer associated with that Order has some credit restrictions. Where is the right place to put this rule is Hibernate ? At a Interceptor class ? At the Order class (using the validate() method of the Validatable interface) ? Regards, Miguel. --- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
RE: [Hibernate] Business Rules
I lean towards not putting that kind of logic in some sort of Manager object.. I find that when you start mixing busienss logic with data objects, soon your business logic tier and data tier become all intertwined. I would lean towards OrderManager or something where you have a call like: OrderManager.createOrder(Customer) throws OrderCreationException or OrderManager.canCreateOrder(Customer) Then put that business logic about credit restrictions into the OrderManager.. Because over time your Customer and Order objects will remain the same, but your business rules on credit restrictions may change! Eric > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf > Of Miguel > Henley > Sent: Tuesday, October 28, 2003 1:07 PM > To: [EMAIL PROTECTED] > Subject: [Hibernate] Business Rules > > > > Hi all, > > Please, take a look at the the following scenario: > A "Order" persistence class is associate to a "Customer" > persistence class and the business rules is: > We can not make a new Order if the Customer associated with > that Order has some credit restrictions. > > Where is the right place to put this rule is Hibernate ? > At a Interceptor class ? At the Order class (using the > validate() method of the Validatable interface) ? > > Regards, > Miguel. > > > --- > This SF.net email is sponsored by: The SF.net Donation Program. > Do you like what SourceForge.net is doing for the Open > Source Community? Make a contribution, and help us add new > features and functionality. Click here: http://sourceforge.net/donate/ > ___ > hibernate-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/hibernate-devel <>
[Hibernate] SchemaExportTask + JBoss
Hallo, there is a way to use jboss-service.xml with Ant's "SchemaExportTask"? Now i create a hibernate.cgf.xml file ONLY to use it with this task but to run JBoss+Hibernate it's not necessary! I'd like to don't mantain hibernate.cfg.xml... Any idea? Gio --- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
Re: [Hibernate] Business Rules
On 28 Oct (12:38), Eric Pugh wrote: > I lean towards not putting that kind of logic in some sort of Manager > object.. I find that when you start mixing busienss logic with data > objects, soon your business logic tier and data tier become all intertwined. Interestingly, thats the reason for a domain model in the first place. :) -- Christian Bauer [EMAIL PROTECTED] --- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
RES: [Hibernate] Business Rules
So, do you think that for each persitence class it's a good design decision to create a Manager class ? The Manager class first check the business rules and if it's Ok calls the save / update / delete methods of the session. Is it right ? Miguel. -Mensagem original- De: Christian Bauer [mailto:[EMAIL PROTECTED] Enviada em: Terça-feira, 28 de Outubro de 2003 09:10 Para: [EMAIL PROTECTED] Assunto: Re: [Hibernate] Business Rules On 28 Oct (12:38), Eric Pugh wrote: > I lean towards not putting that kind of logic in some sort of Manager > object.. I find that when you start mixing busienss logic with data > objects, soon your business logic tier and data tier become all intertwined. Interestingly, thats the reason for a domain model in the first place. :) -- Christian Bauer [EMAIL PROTECTED] --- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel --- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
Re: RES: [Hibernate] Business Rules
On 28 Oct (10:33), Miguel Henley wrote: > So, do you think that for each persitence class it's a good design decision to > create a Manager class ? The Manager class first check the business rules and if > it's Ok calls the save / update / delete methods of the session. Is it right ? No, this is not a good design decision. Your domain model classes should implement the business rules and functions. Some of them might be persistent, but thats what you have Hibernate for. Sometimes you might use a "Manager" type class in your domain model, but most of the time the objects _themselves_ interact by calling business methods on each other and/or passing themselves as arguments. Read up on "Strategy Pattern" and other techniques how to implement this. A good source is Martin Fowler's Patterns of Enterprise Architecture, but it's not "only" about domain model/transaction scripts/business logic design issues. -- Christian Bauer [EMAIL PROTECTED] --- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
RE: [Hibernate] Business Rules
I see the following two options: 1) Make the constructor on Order private and use a static factory method on Order to first verify the Customer does not have credit restrictions before creating the Order. 2) Make the constructor on Order package level access and add a method to Customer to create an Order. Put the credit restriction check there. This assumes it makes sense to have Customer and Order in the same package. I would avoid putting the logic in a validate() method. If the rule is that an order cannot be created for a customer with credit restrictions, you should never create an Order object that breaks that rule. Regards, John Urberg There are two types of programming languages; the ones that people bitch about and the ones that no one uses. - Bjarne Stroustrup -Original Message- From: Miguel Henley [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 28, 2003 6:07 AM To: [EMAIL PROTECTED] Subject: [Hibernate] Business Rules Hi all, Please, take a look at the the following scenario: A "Order" persistence class is associate to a "Customer" persistence class and the business rules is: We can not make a new Order if the Customer associated with that Order has some credit restrictions. Where is the right place to put this rule is Hibernate ? At a Interceptor class ? At the Order class (using the validate() method of the Validatable interface) ? Regards, Miguel. --- This SF.net email is sponsored by: The SF.net Donation Program. Do you like what SourceForge.net is doing for the Open Source Community? Make a contribution, and help us add new features and functionality. Click here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
[Hibernate] one-to-one cascading delete
Hi, Is there is any way how to get entity state before modifications where made to the entity in transaction ?. For example pseudo code: tx.begin() Entity a = session.load( .. ) now we have entity state E1 from the database assuming that entity is not in cache // modify entity state a.modifyState() - state is E2 t.commit() Is there is any way how to get state E1 in the Cascades processing code ? I have looked at SessiomImplementator and I can not figure out how. Main reason for that is that I'm looking how to implement transparent delete on one-to-one associations. Imagine situation: There is Person class which have one-to-one association with PersonInfo right now If I want to delete this association I need to call session.delete(info) It would be nice to have code like this: person.setInfo(null); tx.commit(); In order to implement this Cascades processing code need to know that that association was deleted in this transaction. Thanks, Giedrius --- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
Re: [Hibernate] Re: Re: CGLIB2
Gavin, Is there any possibility of getting the JDBC 3.0 getGeneratedKeys patch applied and into 2.1? I picked up the last round of changes and can build another updated patch for you later this evening if it would help. Thanks, David Morris >>Ah. hm. I am actually ready to release 2.1rc1. Just waiting on >>Bela's stuff. --- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
[Hibernate] what's the best way?
Hi, I have Entitities A, B, & C. B should hold an instance of A. C should hold an instance of A. If I use one-to-one mapping to A in B & C, will it work? or is there any alternative to achieve the above relations. Thanks in advance! dosapati
[Hibernate] ID Generator
ID Generator If you wish to assign this issue/new feature to us, we can develop and contribute to the Hibernate open source. Requirement: 1) Multiple UidGenerator streams (say a stream per table in DB) 2) High performance Requirement - Transaction spanning across public and private network, end to end response time is 3 sec - Hence ID generation is few m.sec 3) Unique identifier of type String / long / int * Say for example a particular DB table may need a String as the ID so the generator need to provide Long.toString(long value); * Other tables may need a long or int. 4) Supporting multiple databases 5) Handle Transaction. * (eg) * Not participate in Transaction (when this is running in a session bean) * Start new Transaction (when this is running in a session bean) etc... 6) Use of high-low algorithm 7) Unique even in a multi-VM environment hilo or seqhilo in Hibernate provides only a few out of the above 7 requirements. We need to have a new type that provides all the above. Design: Our generator will take a name as input (generatorName) The generatorName parameter has to be a unique string, which allows sequential blocks of unique ids to be kept within each class/DB table. This provides the ability to have multiple UidGenerator streams. Internally, key (long, 8bytes) generation is achieved using a so-called high-low algorithm, obtaining the high values (also known as "blocks") from a single persistent source (the UidBlockPool). Within a given block, IDs are generated in memory. The persistent store is accessed only during startup and when a block is exhausted. Depending on application requirement the latter occurrence can be very rare, if the block size is large enough. Table Design : TABLE ES_UIDBLOCKPOOL NAME VARCHAR(50) NOT NULL BLOCK_SIZE LONGINT CURRENT_BLOCK LONGINT Name is the generator name. (usually the name of the class that uses it) The block size helps us to define custom block size. If sequential numbers are needed, we could set the size to 1 Thus this makes it configurable. For each table we can set the custom block size. Current Block will have the current value for the Block for that particular generator name. The IDs are guaranteed to be unique even in a multi-VM environment, as long as the persistent store is shared. IDs are not guaranteed to be sequential. The generator provides unique ID that are either String or long or int based on the request. This could be configured in the same way as the existing ID generator in Hibernate. Advantages: * Custom block size could be set. So could be used as sequence generator also. * It has all the features that we have in Increment, Sequence, Hilo in Hibernate. * Multiple ID Streams * High performance Regards, P. Mukund. - This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message. Also, email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof. --- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
[Hibernate] MySQL/No PK Issue - Cannot Insert
Hi Folks, We have a table 'dummy' with no primary key (playing w/ the dealt cards) which upon trying to perform an insert, we get an unexpected error from mysql java.sql.SQLException: Column not found, message from server: "Unknown column 'hostName' in 'field list'" For other tables with primary keys, we do not see the issue. Judging from the log files, it seems as if 'hostName' is appended to the insert statement, which seems quite odd.. 14:35:41,640 DEBUG SessionFactoryImpl:526 - prepared statement get: insert into dummy (host_name, update_date, hostName) values (?, ?, ?) ...because the schema looks like this. create table dummy ( host_name int(11) NOT NULL , update_date datetime NOT NULL ) ; We are using MySQL 4.0.15, Hibernate 2.0.3 and the mysql-connector.jar 3.0.8 (stable). Anyone run into this? Stack Trace, configuration files and source code are below: 14:35:41,640 DEBUG EntityPersister:464 - Inserting entity: [EMAIL PROTECTED]14:35:41,640 DEBUG BatcherImpl:166 - about to open: 0 open PreparedStatements, 0 open ResultSets14:35:41,640 DEBUG SessionFactoryImpl:526 - prepared statement get: insert into dummy (host_name, update_date, hostName) values (?, ?, ?)Hibernate: insert into dummy (host_name, update_date, hostName) values (?, ?, ?)14:35:41,640 DEBUG SessionFactoryImpl:536 - preparing statement14:35:41,734 DEBUG EntityPersister:366 - Dehydrating entity: [EMAIL PROTECTED]14:35:41,781 DEBUG JDBCExceptionReporter:36 - SQL Exceptionjava.sql.SQLException: Column not found, message from server: "Unknown column 'hostName' in 'field list'" at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1651) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:889) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:956) at com.mysql.jdbc.Connection.execSQL(Connection.java:1874) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1700) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1569) at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22) at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:478) at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:454) at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:20) at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2100) at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2061) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2005) at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:57) at QuickTest.endTransaction(QuickTest.java:69) at QuickTest.main(QuickTest.java:30) -- hibernate.cfg.xml: "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd"> java:comp/env/jdbc/dummy true true net.sf.hibernate.dialect.MySQLDialect --- Dummy.hbm.xml: http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> Dummy.java: package com; import java.io.Serializable;import java.util.Date;import org.apache.commons.lang.builder.ToStringBuilder; /** @author Hibernate CodeGenerator */public class Dummy implements Serializable { /** persistent field */ private Integer hostName; /** persistent field */ private Date updateDate; /** full constructor */ public Dummy(Integer hostName, Date updateDate) { this.hostName = hostName; this.updateDate = updateDate; } /** default constructor */ public Dummy() { } public Integer getHostName() { return this.hostName; } public void setHostName(Integer hostName) { this.hostName = hostName; } public Date getUpdateDate() { return this.updateDate; } public void setUpdateDate(Date updateDate) { this.updateDate = updateDate; } public String toString() { return new ToStringBuilder(this) .toString(); } } --- QuickTest.java: import net.sf.hibernate.*;import net.sf.hibernate.cfg.*;import java.util.Date;import com.Dummy; import test.jndi.JNDIUnitTestHelper; public class QuickTest { private SessionFactory sessionFactory; private Session session; private Transaction tr
[Hibernate] Swarmcache, HashtableCacheProvider
Title: Message Is SwarmCache support active in Beta 4? What about HashtableCacheProvider? Is the use of either of these documented Sandeep
Re: [Hibernate] Re: Re: CGLIB2
Ummm not sure. It is a fairly complex patch, to core functionality. And I am not yet 100% on accepting it (I'm about 80%). I think we would need to go though a beta5 for this. David Morris wrote: Gavin, Is there any possibility of getting the JDBC 3.0 getGeneratedKeys patch applied and into 2.1? I picked up the last round of changes and can build another updated patch for you later this evening if it would help. Thanks, David Morris Ah. hm. I am actually ready to release 2.1rc1. Just waiting on Bela's stuff. --- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel --- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
Re: [Hibernate] ID Generator
To implement this requires an id generator with dependencies upon EJB APIs. ie. it requires a session bean. Hibernate does not currently have dependencies upon EJB. This is an appropriate thing to maintain as part of your application. Pragasam, Mukund (Consultant) wrote: ID Generator If you wish to assign this issue/new feature to us, we can develop and contribute to the Hibernate open source. Requirement: 1) Multiple UidGenerator streams (say a stream per table in DB) 2) High performance Requirement - Transaction spanning across public and private network, end to end response time is 3 sec - Hence ID generation is few m.sec 3) Unique identifier of type String / long / int * Say for example a particular DB table may need a String as the ID so the generator need to provide Long.toString(long value); * Other tables may need a long or int. 4) Supporting multiple databases 5) Handle Transaction. * (eg) * Not participate in Transaction (when this is running in a session bean) * Start new Transaction (when this is running in a session bean) etc... 6) Use of high-low algorithm 7) Unique even in a multi-VM environment hilo or seqhilo in Hibernate provides only a few out of the above 7 requirements. We need to have a new type that provides all the above. Design: Our generator will take a name as input (generatorName) The generatorName parameter has to be a unique string, which allows sequential blocks of unique ids to be kept within each class/DB table. This provides the ability to have multiple UidGenerator streams. Internally, key (long, 8bytes) generation is achieved using a so-called high-low algorithm, obtaining the high values (also known as "blocks") from a single persistent source (the UidBlockPool). Within a given block, IDs are generated in memory. The persistent store is accessed only during startup and when a block is exhausted. Depending on application requirement the latter occurrence can be very rare, if the block size is large enough. Table Design : TABLE ES_UIDBLOCKPOOL NAME VARCHAR(50) NOT NULL BLOCK_SIZE LONGINT CURRENT_BLOCK LONGINT Name is the generator name. (usually the name of the class that uses it) The block size helps us to define custom block size. If sequential numbers are needed, we could set the size to 1 Thus this makes it configurable. For each table we can set the custom block size. Current Block will have the current value for the Block for that particular generator name. The IDs are guaranteed to be unique even in a multi-VM environment, as long as the persistent store is shared. IDs are not guaranteed to be sequential. The generator provides unique ID that are either String or long or int based on the request. This could be configured in the same way as the existing ID generator in Hibernate. Advantages: * Custom block size could be set. So could be used as sequence generator also. * It has all the features that we have in Increment, Sequence, Hilo in Hibernate. * Multiple ID Streams * High performance Regards, P. Mukund. - This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message. Also, email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof. --- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel --- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel
Re: [Hibernate] Re: Re: CGLIB2
Wouldn't that mean that we would get both versions of CGLIB in our lib directory? Perhaps its better to just wait until Proxool has also upgraded. Perhaps we can put some pressure on them to get up to date. Chris Nokleberg wrote: On Tue, Oct 28, 2003 at 08:03:06PM +1100, Gavin King wrote: Whoah but we have a dependency to proxool. Does that mean that integrating cglib 2 will break our proxool support? We will change the base package name before the next beta to prevent binary incompatibility issues. I can send you another patch then. It's a pain but I think the alternative is worse (for example a new version of proxool was just released and it uses CGLIB 1.0). I see the latest version of proxool isn't in "lib" but if you put it there it would be incompatible with the patch...that's why I mention it. If it is a problem we can change the package name now (after which cglib1 and cglib2 can co-exist), make a new patch, and release cglib2-beta2 for hib21-rc1. Chris --- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ ___ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel