Solved

Mysql Temporary Table and Hibernate Connection Pooling

Posted on 2010-08-12
8
1,953 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now