Alaneus Kingingestingest

Greenhorn
+ Follow
since Dec 17, 2008
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 Alaneus Kingingestingest

I use JPA (Toplink) and was wondering if there is such thing as optional field.

Let me explain what I mean:

I'm writing application that can connect to different databases.
For example let's say that in all databases there is table "products", but some have field "quantity", and some not.
So I was wondering if I can have one entity class Product which has all fields mapped (including "quantity"),
but does not generate error while fetching if some database table lacks of that field.
Instead that attribute in object is set to default value (null).

If JPA does not allow such behavior, is there good alternative solution?
Thanks for help, I found that you can use something like:

for getting system variables
Thanks, but do you know how to read platform on which is MySQL (Win, Mac, Linux)?
MySQL keeps track of last update made on table. This feature does not work if MySQL is running on windows platform or if database uses INNODB.
While running application needs to know that feature is not supported.
In phpmyadmin I saw system variables "storage engine" and "version compile os" that hold information about that.
So how can I get values of these variables from java, or is there other solutions of getting to know these values? Maybe by DatabaseMetaData?

Thanks
I'm writing java MDI desktop application for Windows XP, and I realized that windows look and feel is slower than default metal.
Even live dragging of internal frames is good on metal look and feel.
Are there any tips how to make windows look and feel faster?
Maybe some VM parameters needs to be set?

Thanks

14 years ago
I just put my TableModel in JTable, and everything worked ok.

After much of research I found solution for JXTable:
table.setTerminateEditOnFocusLost(false);

References:
http://forums.java.net/jive/thread.jspa?threadID=64281&tstart=1

14 years ago
I also noticed that Boolean type cells which cell editors I didn't even set (JXTable sets it by default), also have this problem of not getting to editing mode unless some String type cell first is double clicked?!?

In my TableModel among other methods I overrided:
14 years ago
JDateChooserCellEditor I didn't create. I'm simply using com.toedter.calendar.JDateChooserCellEditor.
And for my custom class cell editor I used DefaultCellEditor and put my ComboBoxModel for that custom class, as I mentioned:
14 years ago
Hello!

I have table (JXTable) which has columns of type: String, Date and some custom objects.
So I created TableModel for table and set table cell editors by calling:

myTable.setDefaultEditor(MyCustomClass.class, new DefaultCellEditor(new JComboBox(new MyCustomClassComboBoxModel())));
myTable.setDefaultEditor(Date.class, new JDateChooserCellEditor());

I recently noticed that if I want to edit some String column I can normally double click on it and it would go to editing mode, but I can not go to editing mode if I first double click on columns of type: Date or MyCustomClass.
So when I open frame that contains table if I want to edit some Date or MyCustomClass columns I have to click on some String column first to go to editing mode, and then everything works OK (I can edit Date and MyCustomClass columns).
But if I first double click on Date or MyCustomClass columns nothing happens (it does not go to editing mode).

Can somebody explain what am I doing wrong?

Thanks
14 years ago
Hi!

I'm learning JPA, so I have questions about how does it work and about best practices...

Let's say that I have Object A which has OneToMany connection with Object B.
I have method for fetching objects A which creates EntityManager and fetches all Objects A (and its referenced Objects B).
I have also method for fetching objects B which also creates EntityManager and fetches all Objects B.

But here comes the problem: objects B created in first method and objects B created in second method do not have same references (memory location in application), and if I change some property of one object B which is result of second method, same (equal) object B which is created in first method does not change instantly in application because it is not the same object, actually it is copy of that object.

If I use global EntityManager (If I do not create in methods EntityManagers) I do not get this problem, but I saw that creating in method EntityManager is best practice.

Can I somehow say that I do not want duplicate objects?

Sorry for bad english.
Hi all!

I was wondering if it's possible to use FCKeditor in java desktop application? I basically just want to add to my jpanel some HTML WYSIWYG editor. Is there a way to do that with FCKeditor or is there another component that does that?

Thanks
15 years ago
Hi everybody!

I need help with JPA (Toplink) mapping.

I have 3 classes: Products, ProductsDescription and ProductsDescriptionPK.

Products has 1 ID: products_id
ProductsDescription has 2 IDs: products_id and language_id which is in ProductsDescriptionPK, so ProductsDescription has EmbeddedId: ProductsDescriptionPK.

Since 1 product can have many descriptions in different languages,
I wish to bind @OneToMany Products with ProductsDescription by using
products_id, but I can't figure it out how to do it since ProductsDescription has composite key.
Basically I wish to have Collection<ProductsDescription>
in Products which are bindded with its ProductsDescription. Here are the following classes.



Thanks

[ December 17, 2008: Message edited by: Alaneus Kingingestingest ]
[ December 17, 2008: Message edited by: Alaneus Kingingestingest ]