I see the following two options:
1) Make the constructor on Order private and use a static factory method on
Order to first verify the Customer does not have credit restrictions before
creating the Order.
2) Make the constructor on Order package level access and add a method to
Customer to create
Nikolay,
Here's the code I use to pull an object out of the session cache:
// session is an instance variable declared as SessionImpl
private Object getCachedObject(Class clazz, Serializable id) {
try {
ClassPersister persister = session.getFactory().getPersister(clazz);
Key key = new K
That is exactly what I was looking for.
Thanks again for a great tool.
Regards,
John
-Original Message-
From: Gavin King [mailto:[EMAIL PROTECTED]
Sent: Saturday, October 18, 2003 6:06 AM
To: Urberg, John
Cc: '[EMAIL PROTECTED]'
Subject: Re: [Hibernate] Saving Collections fro
ng capabilities are great (plus
we've already mapped quite a few domain objects).
Please let me know if there are any plans to fix Hibernate to work correctly
with objects from separate sessions. I would be glad to help out.
Regards,
John
-----Original Message-
From: Urberg, John [mailto:[E
3-tier environment.
Thanks,
John
-Original Message-
From: Urberg, John [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 16, 2003 11:21 AM
To: '[EMAIL PROTECTED]'
Subject: [Hibernate] Saving Collections from Multiple Sessions
We have a 3-tier Java GUI application using Hiber
We have a 3-tier Java GUI application using Hibernate as the O/R mapping
layer. We've run into the problem of dealing with updating collections from
other sessions. It seems Hibernate will recreate the collection if the
collection was loaded with a different persisted (see
SessionImpl.prepareColl
>> The InvoiceRepository would be implemented like this:
>> [code to load invoices]
> And where do you close those opened sessions using this design? Also,
where
> did you find a place to implement transaction handling, including joining
> into existing transactions if possible?
That's the respon
I notice we can now map classes that don't have public no-arg constructors.
Is it possible to extend that to components also?
Many of the components I use will be value objects and I'd like to make them
immutable (including composite ids). I could do this if Hibernate could use
a private no arg
I like the idea of making it more consistent. That will make it easier to
use.
I personally would vote for defaulting cascade-to-save to null since I don't
use primitives as ids. It might be worth finding out how many folks use
primitives vs. objects as ids before choosing a default.
Regards,
J
On to the second issue:
>>2) Build a message with multiple addressees. I try to save the message
and
>>get a "com.sybase.jdbc2.jdbc.SybBatchUpdateException: JZ0BE:
>>BatchUpdateException: Error occurred while executing batch statement: ASA
>>Error -143: Column '@p1' not found" SQL Exception. He
10:42 PM
To: Urberg, John
Cc: [EMAIL PROTECTED]
Subject: Re: [Hibernate-devel] Update problems
>1) I have a class with a collection. When I load the class, hibernate
tries
>to update the foreign key on the collection table (and tries to set it to
>NULL no less). Here's the mapping:
I tried it with the new build with my domain classes on the classpath...and
it still couldn't find the mapping file! So I messed around a bit and found
the problem. I had it mapped as follows:
/com/vetconnect/client/dao/Client.hbm.xml,/com/vetconnect/client/dao/ClientP
hone.hbm.xml
When it sh
>> Hibernate got everything you need to run JCS, are you sure you
>> put the cache.ccf in the classpath, it's more likely the issue here.
Yup. The cache.ccf from the Hibernate build is in my class path. This is
the full exception I was gettting:
WARNING: Could not instantiate cache - probably
>>And I would expect 3 SQL statements with all the many-to-ones and
>>collections should get resolved from the cache.
>
>To enable caching, you need to add
>
>
>
>to all , , , , , elements
>that you want to cache.
Ahh, I thought that was optional. That would explain it.
So I tried it out and
server's context loader on startup.
Thoughts?
Regards,
John
-Original Message-
From: Christian Meunier [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 08, 2002 10:47 AM
To: Urberg, John; Gavin_King/[EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: [Hibernate-devel] RE: JMX/JBoss
In c
I updated from cvs this morning. I tried out collection caching and am not
getting the results I expect.
Here's some detail:
I have AddresseeGroups which are made up of AddresseeGroupEntrys of either
other AddresseeGroups or Staff.
AddresseeGroup --> AddresseeGroupEntry --> Staff
^
I always forget to copy these to the list...
I guess I don't understand the whole caching thing then. Let's use the
following example:
I have a loan with a collection of borrowers. I issue a query to get all
the borrowers for a loan. Then I issue a query (or a load) to get a loan.
I would ex
>>2) How should I use the mapResources property? You currently have the
>>resources loaded on the first access to SessionFactoryStub.openSession.
>>This means it's likely running in a different class loader than the MBean.
>>So if I try to put the mapping file in the server configuration directory
d value or in a cache in the collection's
CollectionPersistor.
Is that correct?
Thanks,
John
-Original Message-
From: Gavin_King/[EMAIL PROTECTED]
[mailto:Gavin_King/[EMAIL PROTECTED]
Sent: Thursday, August 01, 2002 11:13 AM
To: Urberg, John
Cc: [EMAIL PROTECTED]
Subject: RE: [Hibe
I issue a query to get all messages from the database. I then get all staff
from the database. Staff has a collection of messages based on the staff id
on the message. All the messages are already loaded, but there are still
seperate SQLs generated for each staff to get it's messages.
Is there
Is a JCS cache serializable? If so, how much more would it take to pass the
whole session over the wire?
Thanks,
John
-Original Message-
From: Gavin_King/[EMAIL PROTECTED]
[mailto:Gavin_King/[EMAIL PROTECTED]
Sent: Thursday, July 25, 2002 10:09 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECT
>>I think fully working single-class-to-multiple-table mappings will take
quite a while to implement.<<
What about the option of defining a custom map object for a class. For
those special cases (such as multiple table mappings), the custom map could
handle the mapping to the database using hand
I'm starting a new application I was hoping to start using Hibernate on.
Sure enough, the first object I need to map is a "Narrow View" I'm creating
for a list. It needs to join four tables (2 are the same table).
The SQL would look something like this:
select recipient.firstname, recipient.la
>> Now as for this issue of the MBean needing classpath to the persistent
classes, am I right in assuming that no management calls to the MBean would
ever be able to see the application classpath? <<
I believe that is the case. My (limited) understanding is that anything in
an EJB jar gets its ow
24 matches
Mail list logo