Solved

Mysql Temporary Table and Hibernate Connection Pooling

Posted on 2010-08-12
8
1,998 Views
Last Modified: 2013-11-24
Hi,
Im Using:
Mysql 5.47
Glassfish Server
Hibernate for Mapping and C3P0 connection pooling

Im facing a problem in using temporary table with union with another table in my project... whenever i try to run it through my application it says cant reopen the table...

Please help



0
Comment
Question by:CCBRONET
8 Comments
 
LVL 8

Expert Comment

by:kingjely
ID: 33427146


I think temporary tables are only stored locally for that connection/session. What if you create view instead of temporary table?
0
 

Author Comment

by:CCBRONET
ID: 33427190
nope view wont help coz i need some columns in row format and some data from another table wise which need to be clubed...
0
 
LVL 1

Expert Comment

by:troublesaga
ID: 33427271
You could create a permanent table in tempdb or another database and truncate it after every use.
If the table is in a normal database then truncate will cause problems with transaction log dumps.
The table would need to be re-created after every recycle of the server.

You can use a view to club data from multiple tables.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:CCBRONET
ID: 33427573
@troublesaga:
 permanent table in tempdb or another database wont help me coz im using hibernate for connection
also cant use permanet table in main DB coz in using temporary table for reports so mutiple users will use the table at same time.
also view will be very complex and time consuming in select statement
0
 
LVL 1

Expert Comment

by:troublesaga
ID: 33428437
Have you tried creating the temp table as part of opening up the database connection?
I know that under Sybase you cannot create a temp table using hibernate as hibernate does everything in a transaction and Sybase doesn't allow you to create a temporary table within a transaction.
0
 

Author Comment

by:CCBRONET
ID: 33428735
the temp table is used for report generation only... on 1st login of the application connection is created and then it is pooled....
0
 
LVL 2

Accepted Solution

by:
arch-itect earned 500 total points
ID: 33491725
What is your isolation level.  If it doesn't do an implicit commit on temporary tables it might not be visible in Hibernate.
0
 

Author Closing Comment

by:CCBRONET
ID: 33616021
Great
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question