Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Fixed String or Oracle CHAR
Fixed String or Oracle CHAR [message #376325] Wed, 09 July 2008 14:59 Go to next message
Nick is currently offline NickFriend
Messages: 34
Registered: July 2009
Member
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 20:53 Go to previous messageGo to next message
Gordon Yorke is currently offline Gordon YorkeFriend
Messages: 77
Registered: July 2009
Member
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 15:20 Go to previous messageGo to next message
Nick is currently offline NickFriend
Messages: 34
Registered: July 2009
Member
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 18:33 Go to previous messageGo to next message
Nick is currently offline NickFriend
Messages: 34
Registered: July 2009
Member
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 16:28 Go to previous messageGo to next message
sean agnew is currently offline sean agnewFriend
Messages: 1
Registered: July 2009
Junior Member
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 17:04 Go to previous messageGo to next message
Nick Mising name is currently offline Nick Mising nameFriend
Messages: 8
Registered: July 2009
Junior Member
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] Thu, 05 November 2009 02:20 Go to previous messageGo to next message
Nick Mising name is currently offline Nick Mising nameFriend
Messages: 8
Registered: July 2009
Junior Member
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 21:06 Go to previous message
Nick Mising name is currently offline Nick Mising nameFriend
Messages: 8
Registered: July 2009
Junior Member
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 Dec 22 02:07:12 GMT 2014

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

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