[Hibernate] Urgent - Is this possible through hibernate??
Title: Message Hi everyone, Can someone give me some good suggestions on how to perform an efficient insert-select through using hibernate?? I don't want to use straight SQL because my application will support multiple database and I don't want to create individual SQL for each platform plus the insert-select statement changes according to user request. What is the best way to do an efficient insert-select by using Hibernate to simulate something like the following SQL statement without using static SQL: INSERT INTO TABLE_1(VALUE1, VALUE2, VALUE3) SELECT TABLE_2.VALUE1, TABLE_2.VALUE2, TABLE_3.VALUE3 FROM TABLE_2, TABLE_3 WHERE TABLE2.ID = TABLE_3.ID AND TABLE_2.VALUE4 = 'SOMETHING'. AND TABLE_3.VALUE5 = 'SOMETHING' This is just an example SQL and the application uses different SELECT statements every time and select statement is generated by user. Thanks Vivian Fonger Software Engineer Socketware [EMAIL PROTECTED]
Re: [Hibernate] Urgent - Is this possible through hibernate??
On 19 Nov (10:02), Vivian Fonger wrote: > Can someone give me some good suggestions on how to perform an efficient > insert-select through using hibernate?? I don't want to use straight SQL > because my application will support multiple database and I don't want > to create individual SQL for each platform plus the insert-select > statement changes according to user request. What is the best way to do > an efficient insert-select by using Hibernate to simulate something like > the following SQL statement without using static SQL: You need an SQL abstraction layer and propably not a full object/relational mapping tool. -- Christian Bauer [EMAIL PROTECTED] --- 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] Urgent - Is this possible through hibernate??
Hi Christian, I guess I am not explaining myself clearly. Hibernate fixes extremely well in the whole application except for the following part. Here is the problem: One of the functionalities of my application is allowing users to reduce a set of data from certain tables in the database. The application administrators choose what tables they want to involve in the reductions during setup and users can use our user interface chooses what fields and values they want them to get involve with the reduction. The users can create numerious reductions through our interface. The next step is translating all these inputs into various select SQL queries and move the returning data to a system data for future processing. The problem I have right now is that when I am using Hibernate functionality, I need to perform a session.find(select query) to load all the select data first, and then generates individual session.save for individual object returns from session.find into the system table. This is extremely expensive because my select query might involve more than 1 million records sometime. I want to know is there ANY way that I don't need to select out the data through session.find and save individual data through session.save into the system table. I know in SQL you can perform insert into table1 (v1, v2) values (?, ?) select v4, v5 from table4, table5 where table4.id = table5.id and table4.v6=1 and table5.v7=2 which I don't need to extract the data out from the database and insert into the system table. I wonder if Hibernate has a similar solution so that the application does not need to extract out data from database before inserting into another table. I am very close to my deadline and this is something I need to solve rather quickly. Could you give me some pointers on this issue?? Thanks. Vivian Fonger Software Engineer Socketware [EMAIL PROTECTED] -Original Message- From: Christian Bauer [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 10:11 AM To: Vivian Fonger Cc: [EMAIL PROTECTED] Subject: Re: [Hibernate] Urgent - Is this possible through hibernate?? On 19 Nov (10:02), Vivian Fonger wrote: > Can someone give me some good suggestions on how to perform an > efficient insert-select through using hibernate?? I don't want to use > straight SQL because my application will support multiple database and > I don't want to create individual SQL for each platform plus the > insert-select statement changes according to user request. What is the > best way to do an efficient insert-select by using Hibernate to > simulate something like the following SQL statement without using > static SQL: You need an SQL abstraction layer and propably not a full object/relational mapping tool. -- Christian Bauer [EMAIL PROTECTED] --- 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] Urgent - Is this possible through hibernate??
On 19 Nov (10:38), Vivian Fonger wrote: > involve more than 1 million records sometime. I want to know is there > ANY way that I don't need to select out the data through session.find > and save individual data through session.save into the system table. I For this kind of trivial mass operation, you can't and shouldn't use an object/relational mapping tool. Use an SQL abstraction layer, like iBatis or search Google. I think there is no clean and/or easy solution for this in Hibernate. Please ask further questions on the user forum. -- Christian Bauer [EMAIL PROTECTED] --- 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] Urgent - Is this possible through hibernate??
Vivian, You shouldn't be using Hibernate for this sort of thing. Either write a simple JDBC-based framework on your own. Or pick something that is publicly available. If you are trying to automate an ETL process, then you could try http://octopus.enhydra.org/ (LGPL). I am not sure this is what you are trying to do. This involves processing the data. But it always helps to think out of the box. Sandeep. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vivian Fonger Sent: Wednesday, November 19, 2003 9:39 AM To: Christian Bauer Cc: [EMAIL PROTECTED] Subject: RE: [Hibernate] Urgent - Is this possible through hibernate?? Hi Christian, I guess I am not explaining myself clearly. Hibernate fixes extremely well in the whole application except for the following part. Here is the problem: One of the functionalities of my application is allowing users to reduce a set of data from certain tables in the database. The application administrators choose what tables they want to involve in the reductions during setup and users can use our user interface chooses what fields and values they want them to get involve with the reduction. The users can create numerious reductions through our interface. The next step is translating all these inputs into various select SQL queries and move the returning data to a system data for future processing. The problem I have right now is that when I am using Hibernate functionality, I need to perform a session.find(select query) to load all the select data first, and then generates individual session.save for individual object returns from session.find into the system table. This is extremely expensive because my select query might involve more than 1 million records sometime. I want to know is there ANY way that I don't need to select out the data through session.find and save individual data through session.save into the system table. I know in SQL you can perform insert into table1 (v1, v2) values (?, ?) select v4, v5 from table4, table5 where table4.id = table5.id and table4.v6=1 and table5.v7=2 which I don't need to extract the data out from the database and insert into the system table. I wonder if Hibernate has a similar solution so that the application does not need to extract out data from database before inserting into another table. I am very close to my deadline and this is something I need to solve rather quickly. Could you give me some pointers on this issue?? Thanks. Vivian Fonger Software Engineer Socketware [EMAIL PROTECTED] -Original Message- From: Christian Bauer [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 10:11 AM To: Vivian Fonger Cc: [EMAIL PROTECTED] Subject: Re: [Hibernate] Urgent - Is this possible through hibernate?? On 19 Nov (10:02), Vivian Fonger wrote: > Can someone give me some good suggestions on how to perform an > efficient insert-select through using hibernate?? I don't want to use > straight SQL because my application will support multiple database and > I don't want to create individual SQL for each platform plus the > insert-select statement changes according to user request. What is the > best way to do an efficient insert-select by using Hibernate to > simulate something like the following SQL statement without using > static SQL: You need an SQL abstraction layer and propably not a full object/relational mapping tool. -- Christian Bauer [EMAIL PROTECTED] --- 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
[Hibernate] Extending Session
Hi, for an application I'm writing, it would be useful to extend the functionalities of the Session interface via inheritance, with a class that either "implements Session" or "extends SessionImpl". Unfortunately, if I'm not mistaken, the Configuration class is hardwired to return an instance of SessionFactoryImpl, which is hardwired to return an instance of SessionImpl, so I cannot get a different class unless I subclass Configuration (overriding the buildSessionFactory method), SessionFactoryImpl _and_ SessionImpl. This does not seem an elegant solution to me, so I'm wondering whether it wouldn't be better to either turn SessionFactory into an abstract factory, or at least give the option to specify the actual Session class in Hibernate's properties and instantiate it via reflection (not very elegant either, but maybe simpler). What do you think? Ugo -- Ugo Cei - Consorzio di Bioingegneria e Informatica Medica P.le Volontari del Sangue, 2 - 27100 Pavia - Italy Phone: +39.0382.525100 - E-mail: [EMAIL PROTECTED] --- 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] Other attributes in many-to-many relationship
I have a many-to-many relationship in which some extra attributes are stored in the join table. Consider the following tables: Client ( clientId int PK ) Contact ( contactId int PK, attr1, attr2... ) ContactToClient ( clientId FK, contactId FK, relationshipTypeId int ) - I need to retrieve all Contacts associated with a given client, including attr1, attr2..., and the relationshipTypeId which is stored in the join table. I have been using many-to-relationships in sets to retrieve many-to-manies, like the following, which comes from Client.hbm.xml: but cannot figure out how to include the relationshipTypeId attribute. Also, I'm not sure where to store the relationshipTypeId attribute. Right now, I have it in the Contact class, but I don't know how to map it as a property in Contact.hbm.xml. Any ideas? Austin Rosenfeld __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree --- 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] hibernate service in jboss
The scene: I've successfully written and implemented my hibernate package and implemented it as a JBoss service archive (.sar) I'd like to be able to import the packages in other parts of my (maven) project. Everything goes into an EAR, so the pathing and such is dealt with, it successfully deploys (both the EAR and the included SAR) import com.hagelnx.hibernate.* The problem is: java says the package doesn't exist. Does it only look in .jar files, is that the problem? --- 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] hibernate service in jboss
On 19 Nov (14:07), khote wrote: > The problem is: java says the package doesn't exist. Does it only look in > .jar files, is that the problem? Try to simplify your scenario by removing Maven and ask on the User Forum. -- Christian Bauer [EMAIL PROTECTED] --- 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] Urgent - Is this possible through hibernate??
Hi, I guess I am not explaining myself clearly. Hibernate fixes extremely well in the whole application except for the following part. So why dont you just use a straight SQL query through session.createSQLQuery() or by obtaining the Connection from Hibernate via session.connection() ? Michael --- 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] Composite-id Identity Column Problem
Hi, I got stuck while inserting record in a table which have a Primary key as IDENTITY column and two Foreign Key. In hbm file I have defiend mapping like this: while inserting record it gives me following Exception java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot insert explicit value for identity column in table 'T_CX1_AdmDis_T' when IDENTITY_INSERT is set to OFF. NOTE : I get this exception only when Composite key contain one Primary key defined Identity column (auto-increment) in database. It seems to work fine with Composite Key having Primary Key which is not Identity Column. --- 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] Urgent - Is this possible through hibernate??
You can do it in hebernate without JDBC. Implement stored procedure and use it this way: CREATE FUNCTION myProc() RETURNS INT . CREATE VIEW My_Update( ID, update_count ) as SELECT 'myConstant' , myProc(); Map this view to readonly object. - Original Message - From: "Vivian Fonger" <[EMAIL PROTECTED]> To: "Christian Bauer" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, November 19, 2003 5:38 PM Subject: RE: [Hibernate] Urgent - Is this possible through hibernate?? Hi Christian, I guess I am not explaining myself clearly. Hibernate fixes extremely well in the whole application except for the following part. Here is the problem: One of the functionalities of my application is allowing users to reduce a set of data from certain tables in the database. The application administrators choose what tables they want to involve in the reductions during setup and users can use our user interface chooses what fields and values they want them to get involve with the reduction. The users can create numerious reductions through our interface. The next step is translating all these inputs into various select SQL queries and move the returning data to a system data for future processing. The problem I have right now is that when I am using Hibernate functionality, I need to perform a session.find(select query) to load all the select data first, and then generates individual session.save for individual object returns from session.find into the system table. This is extremely expensive because my select query might involve more than 1 million records sometime. I want to know is there ANY way that I don't need to select out the data through session.find and save individual data through session.save into the system table. I know in SQL you can perform insert into table1 (v1, v2) values (?, ?) select v4, v5 from table4, table5 where table4.id = table5.id and table4.v6=1 and table5.v7=2 which I don't need to extract the data out from the database and insert into the system table. I wonder if Hibernate has a similar solution so that the application does not need to extract out data from database before inserting into another table. I am very close to my deadline and this is something I need to solve rather quickly. Could you give me some pointers on this issue?? Thanks. Vivian Fonger Software Engineer Socketware [EMAIL PROTECTED] -Original Message- From: Christian Bauer [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 10:11 AM To: Vivian Fonger Cc: [EMAIL PROTECTED] Subject: Re: [Hibernate] Urgent - Is this possible through hibernate?? On 19 Nov (10:02), Vivian Fonger wrote: > Can someone give me some good suggestions on how to perform an > efficient insert-select through using hibernate?? I don't want to use > straight SQL because my application will support multiple database and > I don't want to create individual SQL for each platform plus the > insert-select statement changes according to user request. What is the > best way to do an efficient insert-select by using Hibernate to > simulate something like the following SQL statement without using > static SQL: You need an SQL abstraction layer and propably not a full object/relational mapping tool. -- Christian Bauer [EMAIL PROTECTED] --- 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