Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Fixed String or Oracle CHAR
Fixed String or Oracle CHAR [message #376325] Wed, 09 July 2008 10:59 Go to next message
Eclipse UserFriend
I'm in the process of porting an application from Toplink Essentials to
eclipselink because we need some of the new features or extension of
eclipselink, but we encounter a snag...

All things considered, setup and etc, a SessionCustomizer that looks like
below that will handle CHAR columns doesn't work on eclipselink anymore?
Or am I missing something?


Thanks,
Nick


public class OracleSessionCustomizer implements SessionCustomizer {

public void customize(Session session) {
session.getEventManager().addListener(new OracleSessionListener());
//set the default for the columns.
session.getLogin().setDefaultNullValue(String.class, " ");
session.getLogin().setDefaultNullValue(Integer.class, 0);
session.getLogin().setDefaultNullValue(Long.class, 0);
}

class OracleSessionListener extends SessionEventAdapter {
@Override
public void postAcquireConnection(SessionEvent event) {
Connection conn = ((DatabaseAccessor) event.getResult()).getConnection();
OracleConnection oconn = (OracleConnection) conn;
oconn.setDefaultFixedString(true);
}
}

}

The same SessionCustomizer will work in Toplink flawlessly, where the PK's
are CHAR's:

For example using find:
pk.setCol1("XYZ");
pk.setCol2(" "); <--- a single space
EntityA entity = em.find(EntityA.class, pk);

For example using persist:
EntityB entity = new EntityB();
entity.setCol1("XYZ");
entity.setCol2(null);
em.getTransaction().begin();
em.find(entity);
em.getTransaction().commit();
eclipselink will not insert spaces but instead nulls
Re: Fixed String or Oracle CHAR [message #376332 is a reply to message #376325] Thu, 10 July 2008 16:53 Go to previous messageGo to next message
Eclipse UserFriend
This appears to be a regression but may have been completed for
performance reasons. I have filed a bug but this bug will require more
research. I will review early next week.
--Gordon

http://bugs.eclipse.org/240407
Re: Fixed String or Oracle CHAR [message #376339 is a reply to message #376332] Fri, 11 July 2008 11:20 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Gordon!

We will follow your progress with great interest, as CHAR is still a very
important data type of Oracle. It allowed us (many of us) to easily
convert COBOL/ISAM based application to Java/Oracle combo with the help of
Toplink/EclipseLink.
Re: Fixed String or Oracle CHAR [message #376887 is a reply to message #376332] Tue, 22 July 2008 14:33 Go to previous messageGo to next message
Eclipse UserFriend
Hi Gordon, I can see that you've proposed a fix for the said issue. Looks
good to me... :-)
Re: Fixed String or Oracle CHAR [message #381078 is a reply to message #376332] Wed, 03 September 2008 12:28 Go to previous messageGo to next message
Eclipse UserFriend
Hi, I've been eagerly awaiting this fix but haven't seen it in the latest
releases. Do I need to build from the source? Thanks.
Re: Fixed String or Oracle CHAR [message #493313 is a reply to message #376332] Sat, 24 October 2009 13:04 Go to previous messageGo to next message
Eclipse UserFriend
The patch worked for inserts. However, it doesn't work for Find and createQuery.

Is there something we need to do? Thanks
Re: Fixed String or Oracle CHAR [message #495482 is a reply to message #493313] Wed, 04 November 2009 21:20 Go to previous messageGo to next message
Eclipse UserFriend
For those who are following this. I filed a bug report against this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=294138
Re: Fixed String or Oracle CHAR [message #495735 is a reply to message #495482] Thu, 05 November 2009 16:06 Go to previous message
Eclipse UserFriend
Good news!!!

https://bugs.eclipse.org/bugs/show_bug.cgi?id=294138 is now slated for 1.1.4.

Big Thanks to Tom Ware!!!
Previous Topic:Unexpected Behaviour of Teneo while committing a transaction
Next Topic:OneToMany, FetchType.LAZY, CascadeType.ALL: Fails to persist child
Goto Forum:
  


Current Time: Mon Jul 07 05:15:58 EDT 2025

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

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

Back to the top