Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Changing Tablename changes on-the-fly?(trying to determine if this is possible)
Changing Tablename changes on-the-fly? [message #1063235] Wed, 12 June 2013 18:53 Go to next message
Adam Vainder is currently offline Adam VainderFriend
Messages: 2
Registered: June 2013
Junior Member
We have a reporting detail table that, due to performance concerns, we are considering refactoring to produce a new instance of the table for each individual report. The table names would end with "_<report_id>" e.g. details_1, details_2, etc

This is an Oracle 11g SE with no option to switch to Enterprise, nor to change to a different database with partitioning; the reason for the consideration is that as the table gets large and/or stale rows are deleted, the performance gets terrible.

One thing stopping us is that our Eclipselink entity has the @Table attribute.

Eclipselink 2.4.1
Glassfish 3.1
Eclipselink access is being made in web services in GF.

We also would have multiple user at once, so any solution would have to be entirely session-based.

I would like to know if, and how, we could change the table name for the entity on-the-fly (at startup is not an option because new reports can happen all the time)?


Thank you for your time.
Re: Changing Tablename changes on-the-fly? [message #1064283 is a reply to message #1063235] Tue, 18 June 2013 14:28 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You have a few options:
- Encapsulate access to the table through stored procedures or a view that direct to the correct table, you can override EclipseLink CRUD queries using stored procedures.
- Use native SQL queries to access the table.
- You could investigate EclipseLink dynamic Entity feature to try an define new classes/descriptors at runtime to map to new tables.

http://wiki.eclipse.org/EclipseLink/Examples/JPA/CRUDStoredProcedures

http://wiki.eclipse.org/EclipseLink/Examples/JPA/Dynamic


James : Wiki : Book : Blog : Twitter
Re: Changing Tablename changes on-the-fly? [message #1086704 is a reply to message #1064283] Wed, 14 August 2013 15:38 Go to previous message
Adam Vainder is currently offline Adam VainderFriend
Messages: 2
Registered: June 2013
Junior Member
Hi James,

Thank you for the thoughts, and apologies for the late thank you. My focus was shifted and completely forgot about this post until we came back to the issue.

Unfortunately, dynamic will not work, as (from my testing at least) the dynamic switch was only performed at startup, and not every call as desired. Please correct me if my results were mistaken.

However, the other two suggestions have given us some ideas, and I very much appreciate it!

Adam
Previous Topic:SQLServer IDENTITY_INSERT fails --SOLVED
Next Topic:Changing schema of ClassDescriptor in Container
Goto Forum:
  


Current Time: Wed Apr 24 13:38:05 GMT 2024

Powered by FUDForum. Page generated in 0.02849 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top