Carty Ellis

Greenhorn
+ Follow
since Oct 04, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carty Ellis

Is it possible to extend the object retrieved from deserialized in order to add a value to a new column if the new column is both "not nullable" and a default constraint is not appropriate? Then to open a new session and put out the object?
18 years ago
I have a concept question. A piece of software I am part of a development team on is having a slight problem, and I'm looking for some astute direction. The tools in question are Spring and Hibernate. We have an object mapped to a specific version of a database with hibernate. My reasoning is that when I pick up and object from that database, it should be the responsibility of the API to allow me to return that object to a different version of the database (some columns have been added), not the responsibility of the program retrieving and sending the object.

What is the wisdom at the Saloon on this topic?
18 years ago
Whoops!

Was in wrong directory. Thanks. It works now.

18 years ago
When I use this code:

public class SwingSerial extends JDialog {

public SwingSerial(JFrame frame) {

super(frame, true);
ImageIcon image = new ImageIcon("WizardTiny.GIF");
frame.setIconImage(image.getImage());
setTitle( "DARS Serialize D/B" );


The Title in the frame is changed, and the default (java cup) icon is gone. No errors are thrown. There is just no WizardTiny.GIF on the frame. If I comment out the ImageIcon line and the frame.setIconImage lines I get the java cup.

If I comment out just the ImageIcon line it wants an image defined.

If I comment out just the frame.setIconImage I get the java cup.

Where is the disconnect in what I am doing?

java 1.5.0_04
18 years ago
This works fine for me

public static void main(String[] args) {
/*
* The following "try" sets the look and feel of the system the
* application is running on
*/
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (NoClassDefFoundError e) {
System.out.println("UIManager error:" + e.getMessage());
} catch (Exception e) {
System.out.println("MESSAGE:" + e.getMessage());
}

RunConversionLoad gui = new RunConversionLoad();
gui.go();
}
18 years ago
This works:

public void go() {
JFrame frame = new JFrame("DARS Data Loader");
JPanel panel = new JPanel();
panel.setBorder(new EtchedBorder(EtchedBorder.RAISED));
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

ImageIcon image = new ImageIcon("WizardTiny.GIF");
frame.setIconImage(image.getImage());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


This does not:

public class SwingSerial extends JDialog {

public SwingSerial(JFrame frame) {
super(frame, true);
setTitle( "DARS Serialize D/B" );
ImageIcon image = new ImageIcon("WizardTiny.GIF");
setIconImage(image.getImage());
setSize(500, 300);



The Title works, but I can't get the image to replace the cup. I anticipate my approach to be wrong, but what would be the "recommended" method?
18 years ago
Is the event handler NOT doing three things between the brackets? My intent was that the event handler would setText to the text area, call the method for loading the database file, and lastly, setText with anohter message. Steps 2 and three happen, but not the first - why is it lost?
20 years ago
I have written this code:
*/ -- my code
class JconvmrefListener implements ActionListener {
public void actionPerformed(ActionEvent ev) {
text.setText("Jconvmref executing. . .");
Jconvmref.loadMastref();
text.setText("Jconvmref completed\nRun another load or click the 'Close Window' button");
}
}
*/
The SECOND setText appears, but the first never does. ???
20 years ago
"Nevermind" as Emily Latella would say -
Whoops. I found it.
I am accessing an Oracle DB via JDBC - Database column defined as num(6,4).
Data coming into the program is a string "010000" which I handle with:
int iscale = NumberUtils.stringToInt(StringUtils.substring((inList.get(i+2)).toString(),5,11));
munitscale = (float) iscale / 10000;
When I System.out.println(munitscale) I get 1.0 for a value. However when I try to insert that value into the database column I get an "ORA-1401 Inserted value too large for column."
I am NOT using a prepared statement - the one place I need prepared I am handling with an escape clause (ts) - TimeStamp.
Any suggestions?
In lots of further digging, I finally came upon JDBC escape sequences. That is the answer. I want code that is truly data base INSENSITIVE - very importnat to my application. Thanks for the replies.
20 years ago
What is a "good" way to develop prepared statements in Servlets? My specific concern is the date in a JDBC statement. I need the servlet to work with Oracle, SQL Server and Sybase - hence the JDBC, but the date specifically needs to be "prepared".
20 years ago
I am using a string for the date. Here is the statement using newDate:
PreparedStatement statementInsertDate = conn.prepareStatement(
"INSERT INTO tca_master " +
"(instidq, instid, instcd, source_id," +
"source_cd, dpmask, fyt, lyt, iname," +
"univ_dpmask, dinstid, dinstcd, tastatus," +
"last_mod_user, last_mod_date)" +
"VALUES " +
"('73', 'MIAMI', 'CAE'," +
"'002463 ',' '," +
"' ', '200402', '200206', 'ELOM UNIVERSITY'," +
"' ', ' ', ' ', ' '," +
"'CAE', '" + newDate + "')");

I am sure the approach is incorrect - I looked at NLS-DATE-FORMAT in the Oracle DB (we have no input on how that is set) and on that DB it is DD-Mon-YY so the approach I was considering is doomed to failure.
"Hibernate" is a new word to me. Other than Google searches - can you suggest a good direction to learn the concept? (It's not mentioned in "Head First Java")
Here is a good challenge. I have a program which needs to update a column - DATE type in Oracle, datetime type in SQL Server. I currently am able to get the newDate, with proper value, from this piece of code:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
long time= System.currentTimeMillis();
java.sql.Date systemsqldate=new java.sql.Date(time);
java.util.Date dateString=(java.util.Date)systemsqldate;
String newDate = null;
newDate = sdf.format(dateString);

to look fine in SQL Server. In Oracle I get the infamous ORA-01861: literal does not match format string. I really want this program to function by just switching drivers and connection statements. I do not want to parse actual code based upon the DB. Just for additional color, It will also need to work with DB2.
Any great minds out there that have successfully faced this one?
[ March 18, 2004: Message edited by: Carty Ellis ]I am using PreparedStatement to avoid DB sensitive issues - but it isn't working that way.
[ March 18, 2004: Message edited by: Carty Ellis ]