Persist object with Hashtable
Hello, I am trying to persist an object with a Hashtable.
I have a Feature object which has a hashtable of qualifiers. Both of the
key and value are of java.lang.String data type.
In my System.jdo:
<package name="com.primaci.bioprojects.plugins.geneMap">
<class name="Feature">
<field name="_qualifiers">
<map key-type="java.lang.String" embedded-key="true"
value-type="java.lang.String" embedded-value="true"/>
</field>
</class>
</package>
After running ant, when I try to run the web application, I got the
following exception, is there anything wrong with the system.jdo?
javax.servlet.UnavailableException: Startup exception:
javax.jdo.JDOFatalUserException: The system could not initialize; the
following registered persistent types are missing metadata or have not
been enhanced: [class com.primaci.bioprojects.plugins.geneMap.Feature].
at
com.primaci.bioprojects.startup.StartupServlet.init(StartupServlet.java:68)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:852)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3267)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3384)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:612)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:307)
at
org.apache.catalina.core.StandardService.start(StandardService.java:388)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:505)
at org.apache.catalina.startup.Catalina.start(Catalina.java:776)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
Alex,
What you did looks about right. The exception that you are seeing is
because you have not registered the Feature class with Kodo JDO. You can
do this either by running the schematool or by enumerating all the
persistent types in the 'persistent-types' preference. See the Kodo JDO
User Guide for more information.
-Patrick
[email protected] (Alex Tang) writes:
Hello, I am trying to persist an object with a Hashtable.
I have a Feature object which has a hashtable of qualifiers. Both of the
key and value are of java.lang.String data type.
In my System.jdo:
<package name="com.primaci.bioprojects.plugins.geneMap">
<class name="Feature">
<field name="_qualifiers">
<map key-type="java.lang.String" embedded-key="true"
value-type="java.lang.String" embedded-value="true"/>
</field>
</class>
</package>
After running ant, when I try to run the web application, I got the
following exception, is there anything wrong with the system.jdo?
javax.servlet.UnavailableException: Startup exception:
javax.jdo.JDOFatalUserException: The system could not initialize; the
following registered persistent types are missing metadata or have not
been enhanced: [class com.primaci.bioprojects.plugins.geneMap.Feature].
at
com.primaci.bioprojects.startup.StartupServlet.init(StartupServlet.java:68)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:852)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3267)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3384)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:612)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:307)
at
org.apache.catalina.core.StandardService.start(StandardService.java:388)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:505)
at org.apache.catalina.startup.Catalina.start(Catalina.java:776)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
Patrick Linskey [email protected]
SolarMetric Inc. http://www.solarmetric.com
Similar Messages
-
Could not persist object with token:re00100000b7f6e12d419f(Error: INF)
Post Author: saravanan rangaraj
CA Forum: Migration to XI R2
Hi everybody,
I'm getting error, 'could not persist object with token:re00100000b7f6e12d419f(Error: INF)' while refreshing reports in infoview. If I logoff and logon it's working fine. The error repeats everytime after refreshing 3-5 reports.Can anybody say why it happens?Post Author: saravanan rangaraj
CA Forum: Migration to XI R2
Hi everybody,
I'm getting error, 'could not persist object with token:re00100000b7f6e12d419f(Error: INF)' while refreshing reports in infoview. If I logoff and logon it's working fine. The error repeats everytime after refreshing 3-5 reports.Can anybody say why it happens? -
Using SequenceFactory getNext in persistent object constructor
Hi,
Rightly or wrongly (maybe wrongly cos I am getting problems...)
In my persistent object constructors, I am initialising the objects id
field using the sequence factory getNext() method.
If I run the schematool on a blank DB with no tables then it works fine -
classes are enhanced, tables created.
But if I run it again on the same db, it fails on the first persistent
object, with this stack trace:
[java] java.lang.ExceptionInInitializerError:
javax.jdo.JDOFatalUserException: The system could not initialize; the
following registered persistent types are missing metadata or have not
been enhanced: [class com.rabobank.reef.tradeadapters.dto.ReefSystem].
[java] at
com.solarmetric.kodo.impl.jdbc.JDBCPersistenceManagerFactory.loadPersistentTypes(JDBCPersistenceManagerFactory.java:293)
[java] at
com.solarmetric.kodo.impl.jdbc.JDBCPersistenceManagerFactory.setup(JDBCPersistenceManagerFactory.java:256)
[java] at
com.solarmetric.kodo.runtime.PersistenceManagerFactoryImpl.privateSetup(PersistenceManagerFactoryImpl.java:872)
[java] at
com.solarmetric.kodo.runtime.PersistenceManagerFactoryImpl.getConnectionFactory(PersistenceManagerFactoryImpl.java:223)
[java] at
com.solarmetric.kodo.impl.jdbc.JDBCPersistenceManagerFactory.setLogWriter(JDBCPersistenceManagerFactory.java:175)
[java] at com.rabobank.util.kodo.JDOFactory.<init>(Unknown Source)
[java] at com.rabobank.util.kodo.JDOFactory.getInstance(Unknown
Source)
[java] at
com.rabobank.util.kodo.JDOFactory.getNextPrimaryKey(Unknown Source)
[java] at
com.rabobank.reef.tradeadapters.dto.GenericObject.<init>(Unknown Source)
[java] at
com.rabobank.reef.tradeadapters.dto.ReefSystem.<init>(Unknown Source)
[java] at
com.rabobank.reef.tradeadapters.dto.ReefSystem.<clinit>(Unknown Source)
[java] at java.lang.Class.forName0(Native Method)
[java] at java.lang.Class.forName(Class.java:115)
[java] at
com.solarmetric.kodo.impl.jdbc.schema.SchemaTool.main(SchemaTool.java:1115)
[java] Exception in thread "main"
Which looks like the sequence factory requires an initialised system to be
accessed, but it is trying to init the system when it is called?
But it works on a clean db...
I am just going about this the wrong way or is it a simple bug in my
procedure?
Thanks,
Chrisheres the exact error message im getting
Exception in thread "main" java.lang.NullPointerException
at instrument.<init>(instrument.java:15)
at iContainer.populate(iContainer.java:34)
at main.main(main.java:7)
the bolded line is the erroneous one
public instrument(int newID, String newType, String newRenters [], int newPrice, String newKey, boolean newNeedsRepairs)
super(newID);
type = newType;
for ( int x = 0; x < newRenters.length; x++)
*renters[x] = newRenters[x];*
price = newPrice;
key = newKey;
needsRepairs = newNeedsRepairs;
} -
I'm trying to implement objects with CLOBs and am having a bit of trouble. Everything works fine right up to the Clob::open() call where my program aborts (dumps core).
I'm running the 9i client on a RedHat 9 box.
I read in the OCCI Developers Manual about objects with Lobs but that section seems most interested in creating new objects whereas I'm simply trying to update one.
I do an "INSERT INTO ..." and then a "SELECT REF() ..."
In my case the whole row is the object.I got over this problem by just using the example from page 5-16 of the manual (funny how things work when you actually follow instructions). But now I'm having a different problem.
I have a persistent object with CLOBs. I insert my object using the example on page 5-16. Following the Clob::write() I do an Clob::open() and a Clob::read() on the clob I just wrote. The read returns 0 and the buffer contains garbage but the row of the table actually has data.
I thought with persistent objects I could get my data back again without having to do another query. Is this correct? What am I doing wrong? -
Hashtable with persistent object as key and collection as value
I am trying to use a Hastable with a persistent object as the key and a
collection as the value. A long time ago, Abe White said:
"Kodo currently does not support a map in which the keys are persistent
objects and the values are collections. I think your best bet would be
to create an intermediate class that has a 1-1 relation to the "key" and
a collection of persistent objects for the "value". Then keep a
collection of these intermediate objects. You could use jdoPostLoad and
jdoPreStore to hash/unhash the collection of intermediate objects to/from
a Map if you need to."
So I made an intermediate class, which gave me a Hashtable with a persistent
object as the key and another for the value. Then the one for the value
contains the collection. This works but I'm wondering about the
performance, would this method be slower?
Also it was said that version 3.0 would support this. I'm curious if this
is available in 2.5 or if it's still planned for 3.0.
Thanks
MichaelI'm observing massive performance problems but I didn't think it could be
caused by this intermediary object but maybe that is the problem. For
example if I start a transaction to delete everything (with 3,000 records
which in turn has 3,000 records which in turn has 2 lists each) theprogram
crashes before it can finish the transaction. I then put in some loops to
delete 100 records at a time and this runs but it took over an hour to
delete the 3,000 records.
Do you have any other ideas of how to improve the performance? Are there
any alternatives?I solved the performance problem. I was storing web page content (all the
HTML) in a String which by default is in the default-fetch-group. I had
been thinking this was using lazy-loading but it wasn't. So I put
default-fetch-group=false for this property and now the performance is
great. It makes sense because it was retrieving approximately 5k of text
for each record! When deleting 3,000 records this comes out to be 14 megs.
Moral of the story: Use the default-fetch-group wisely!! -
Problem with Persistent Object as Reference Attribute of Persistent Object
Hello All,
I have a problem with a persistent class that contains a reference attribute to another persistent class. I can write the reference object attribute to the DB but when I read the reference attribute back from the DB the object is null. Allow me to explain...
I have two tables; one is a data table with one key field of type OS_GUID, the second is a mapping table with several business key fields and two further fields; an instance GUID and a class identifier GUID. The data table is used to contain all the data for an object. The mapping table is used to hold a relationship between the GUID assigned in the data table and the business key. The mapping table has been structured in this way by following the help here:
http://help.sap.com/saphelp_erp2005vp/helpdata/en/df/e785a9e87111d4b2eb0050dadfb92b/frameset.htm
and the field mapping in persistent class for the mapping table has been mapped following the help here:
http://help.sap.com/saphelp_erp2005vp/helpdata/en/06/f23c33638d11d4966d00a0c94260a5/frameset.htm
The code I use to create entries in the data and mapping table is:
<-snip->
DATA:
gv_blank_data_guid TYPE REF TO zcl_ps_data,
gv_data_guid TYPE os_guid,
go_data_ps TYPE REF TO zcl_ps_data,
go_data_agent TYPE REF TO zca_ps_data,
go_data_map_ps TYPE REF TO zcl_ps_data_map,
go_data_map_agent TYPE REF TO zca_ps_data_map,
go_exc TYPE REF TO cx_root.
go_data_agent = zca_ps_data=>agent.
go_data_map_agent = zca_ps_data_map=>agent.
TRY.
Check if there's already data with the business key on the DB
go_data_map_ps = go_data_map_agent->get_persistent(
i_data_ref = iv_data_ref
i_action = iv_action ).
... if there is then exit.
EXIT.
CATCH cx_root INTO go_exc.
ENDTRY.
TRY.
Create the data...
go_data_ps = go_data_agent->create_persistent(
i_root_guid = gv_blank_data_guid
i_req_date = iv_req_date ).
TRY.
... finally, write the new data to the data business key map table
go_data_map_ps = go_data_map_agent->create_persistent(
i_data_ref = iv_data_ref
i_action = iv_action
i_data_guid = go_data_ps ). "note1
CATCH cx_root INTO go_exc.
ENDTRY.
CATCH cx_os_object_not_found.
ENDTRY.
COMMIT WORK.
<-snip->
The fact that it is possible to pass the object GO_DATA_PS in the call to GO_DATA_MAP_AGENT (the line that I've put the comment "note1" on) indicates to me that the reference to the data persistent object can be written to the DB by the mapping persistent object. After executing the above code the mapping table object and class identifier fields are populated. Also, if multiple entries are written to the tables then the class identifier field in the mapping table is always the same and the object ID is different as expected.
However, the problem I have is if I read an object from the DB using the business key with the following code:
<-snip->
DATA:
gv_req_date type datum,
gv_data_guid TYPE os_guid,
go_data_ps TYPE REF TO zcl_ps_data,
go_data_agent TYPE REF TO zca_ps_data,
go_data_map_ps TYPE REF TO zcl_ps_data_map,
go_data_map_agent TYPE REF TO zca_ps_data_map,
go_exc TYPE REF TO cx_root.
go_data_agent = zca_ps_data=>agent.
go_data_map_agent = zca_ps_data_map=>agent.
TRY.
Read data mapping with the business key
go_data_map_ps = go_data_map_agent->get_persistent(
i_data_ref = iv_data_ref
i_action = iv_action ).
... then read the data.
TRY.
CALL METHOD go_data_map_ps->get_data_guid
RECEIVING
result = go_data_ps.
CATCH cx_os_object_not_found.
ENDTRY.
CATCH cx_root INTO go_exc.
ENDTRY.
<-snip->
At no point during this code are the attributes of the object of the persistent class for the data table populated with the contents of the fields of the data table referenced as the attribute of the mapping table. To clarify, when viewing the object in the debugger all the attributes of the mapping object that are simple table fields are populated with the values of the fields of in the mapping table, however, the attributes of the object that represents the persistent class for the data table are not populated with the fields of the data table. I had hoped that by reading the mapping table object the data object would automatically be populated. Is there another step I need to perform to populate the data object?
I'm sorry if the above is hard to follow. Without being able to provide screenshots it's difficult to explain.
If someone has managed to store references to persistent objects in a table and then read the references back could you list the steps you went through to create the persistent classes and include the code that reads the objects please? The code I have almost works, I must be just missing some subtle point...
Thanks in advance,
Steve.Hi Andrea,
The iObject being replicated at item level for Service Complaints is the SAP standard behaviour.
Generally we raise complaint refering to some sales or service issues. In your scenario you are trying to create a complaint based on an iObject, then you have to mention the corresponding product details. I dont see any business requirement not to copy the iObject product at the item level.
If you want it then I think only you have to write a Z program for it.
Hope this helps!
Regards,
Chethan -
Cannot persist detached object with @ManyToOne
I have a simple table that holds named relationships between 2 objects. I am using a @ManyToOne type from the relationship object to each of the parent and child objects.
If the parent and child have NOT already been persisted everything works fine. However if either of them have been previously persisted I fail with a "Cannot persist detached object" error. Why is this, and what is the resolution?
Through much trial and error I was never able to get em.merge to resolve the issue. However I did implement a @PrePersist and registered both parent and child in the UnitOfWork and this did make the problem go away. This 'hack' however cannot be the right solution since its not portable in any fashion across other ORM providers.
It's seems as though the Cascade.PERSIST should handle the fact that the objects have already been persisted?
The following is the relationship class:
@Entity
@Table(name="UDM_RELATIONS")
public class UdmRelationship extends UdmPersistentObject
* If the parent has not be saved then let the persist of this object take care of it.
* Don't touch the parent if this relationship is removed.
@ManyToOne(cascade=CascadeType.PERSIST)
@JoinColumn(name="PARENT_ID")
protected UdmPersistentObject parent = null;
* If the child has not be saved then let the persist of this object take care of it.
* Don't touch the parent if this relationship is removed.
@ManyToOne(cascade=CascadeType.PERSIST)
@JoinColumn(name="CHILD_ID")
protected UdmPersistentObject child = null;
* Name the relationship for easier querying and viewing of direct table data.
@Column(name="REL_NAME")
protected String relationshipName = null;
// Initialization
public UdmRelationship(String relationshipName)
this.relationshipName = relationshipName;
public UdmRelationship()
Annotation annotation = this.getClass().getAnnotation(DiscriminatorValue.class);
if ( annotation != null )
DiscriminatorValue dv = (DiscriminatorValue) annotation;
this.relationshipName = dv.value();
// Data Management
@XmlAttribute(name="type")
protected String getRelationshipName() { return this.relationshipName; }
@XmlTransient
protected UdmPersistentObject getParent() { return this.parent; }
protected void setParent(UdmPersistentObject parent) { this.parent = parent; }
@XmlTransient
protected UdmPersistentObject getChild() { return this.child; }
protected void setChild(UdmPersistentObject child) { this.child = child; }
@PrePersist
public void merge()
Server server = (Server) SessionManager.getManager().getSession("udm-tests");
Session session = (Session)server.getActiveSession();
session.acquireUnitOfWork().registerObject(this.parent);
session.acquireUnitOfWork().registerObject(this.child);
The following is the error:
junit.framework.AssertionFailedError: Unable to create Personal Contact: [Persistent Object [com.riscs.tools.data.udm.support.PersonalContact] save failed.; nested exception is javax.persistence.EntityExistsException:
Exception Description: Cannot persist detached object [com.riscs.tools.data.udm.support.Person@1f47ae8].
Class> com.riscs.tools.data.udm.support.Person Primary Key> [403]]Hello,
I wasn't clear. Merge is used on unmanaged objects to 'merge' the changes into the managed object. If the object is new, it will return a managed copy of the object. The only difference between merge and persist when passed in a new object, is that persist makes the passed in object managed, where as merge returns a managed copy - the object passed in remains unmanaged.
As for it being a no-op - it takes a unmanaged copy of an object and returns the managed copy. It will take any changes and merge them into the managed copy, which as you said, is a no-op if there aren't changes. But your object model must have changes - you set a parent-child bidirectional relationship. Also, merge will cascade over the tree. So if you call it on your parent, and you have added a new child in say a 1:M mapping, it will persist the child - if you have the relation set to cascade merge+persist.
What are the problems you run into with merge?
As for find - depending on your options, it will hit the cache. The point is that the spec requires you to only reference managed objects. I believe this is to allow the cache to maintain object identity - it would cause problems if you read back the newly persisted child and its referenced parent was unmanaged. Any changes to the parent (such as adding the child to its collection) also need to be managed, so the only way to do that is on a managed copy -either by first using find and then making the changes or by merging the changes made to a detached copy.
Best Regards,
Chris -
Locking with Persistent Objects???
Hi,
while updating database with Persistent Objects? does persistent layer takes care of locking the records??
i am not sure locking mechanism is there!!
Please suggestFrom help.sap.com:
If several programs use the Persistence Service to instantiate objects of the same class before one of these programs has changed the state using COMMIT WORK, all the objects will have the same initial state. At present, we have not implemented a Persistence Service lock concept, which would ensure that there was only one transient mapping for each persistent object. So ultimately, ABAP programmers are not really working with persistent objects as such; rather, the Persistence Service makes it appear as if they are.
Regards
Marcin -
Switch between transient and persistent objects?
Hi Folks,
I'm Re: transient object to persistent to ask this type of question, but couldn't find an answer.
Using persistent classes, does anyone know an elegant way to convert a transient object to a persistent one and vice versa? There is no standard functionality provided that I can see, and cloning the object results in clashing keys.
What am I trying to accomplish?
I need an object instance which <i>may</i> exist in the DB and if not, it <i>may</i> need to be saved for future use. I'm using a table with key fields K1 and K2 and the app will ask for an object instance using the full key K1+K2.
If the object doesn't find a DB record for K1K2 then it should instantiate itself with values for K1blank. Here is where I'm considering transient in order to provide the app with default functionality defined in record K1+blank.
If a write access occurs to a transient object then is should become persistent and the K1+K2 record be created.
Any ideas appreciated.
Cheers,
MikeHi Mike,
I written something similar working on Persistent Objects.
The only point of attention is that you cannot create a new persistent while a transient is resident in memory.
This is checked by the OS system during the creation of a new persistent:
in method CREATE_PERSISTENT of Basis Class, there is a check on the existing object:
* Precondition : No object exists with the given business key, neither
* in memory nor on database.
So, you can create a new transient, fill it with the values you need and then pass this values to the agent to create a new persistent, but only after releasing the existing transient (because they will have the same key).
I've solved the problem like this:
METHOD flush.
"IMPORTING value(im_transient) TYPE REF TO zcl_liquidate_daily_bo
"IMPORTING value(im_commit) TYPE xfeld
"IMPORTING value(im_agent) TYPE REF TO zca_liquidate_daily_bo
"RETURNING value(re_persistent) TYPE REF TO zcl_liquidate_daily_bo
"--> raised by event PERNR_PROCESSED
DATA: s_dip_liq TYPE zhr_tm_dip_liq.
s_dip_liq-zpernr = im_transient->get_employee_no( ).
s_dip_liq-zsocmat = im_transient->get_matricola_legale( ).
s_dip_liq-zdataev = im_transient->get_event_date( ).
s_dip_liq-zcodev = im_transient->get_event_type( ).
s_dip_liq-zdescev = im_transient->get_event_descr( ).
s_dip_liq-zmotev = im_transient->get_event_reasn( ).
s_dip_liq-zmeseall = im_transient->get_mese_allineamento( ).
s_dip_liq-zannoall = im_transient->get_anno_allineamento( ).
* // Invalidate the transient before create the persistent!
im_agent->if_os_factory~release( im_transient ).
CLEAR im_transient.
IF im_commit EQ abap_true.
TRY.
re_persistent =
im_agent->create_persistent( EXPORTING i_anno_allineamento = s_dip_liq-zannoall
i_mese_allineamento = s_dip_liq-zmeseall
i_employee_no = s_dip_liq-zpernr
i_event_date = s_dip_liq-zdataev
i_event_type = s_dip_liq-zcodev
i_event_descr = s_dip_liq-zdescev
i_event_reasn = s_dip_liq-zmotev
i_matricola_legale = s_dip_liq-zsocmat ).
CATCH cx_os_object_existing.
ENDTRY.
COMMIT WORK AND WAIT.
ENDIF.
ENDMETHOD.
This method is called inside a loop on a table that containes references to transient objects.
For each object I perform some tasks, and if all it's ok I raise the event PERNR_PROCESSED, which automatically calls this method FLUSH, transferring the transient to the persistent.
Return Object is the new persistent, which will be passed back to the internal table, changing the content from the transient to the new persistent.
Hope this helps,
Roby. -
JSF + Hibernate - non- persistant objects in a dataTable
This is more of a conceptual question, concerning creating a dataTable from a list.
I have a User-with-Projects 1:M relationship. Projects are obligatory and not obligatory. I have a user with one compulsory project and a 5 not obligatory. The point is that the 6 projects should be visible in the UI under a h:dataTable component while each inputText from the dataTable should be mapped to beans. The obligatory project is always persisted in the DB, but the others are persisted only if data is inserted in the UI.
So my question is:
How could I form a dataTable, including the 6 project, and check if a data is inserted in the not-compulsory ones?
I tried to create a User object with 6 Project entities (pojo classes), the first one is persisted in the DB and the others are not. This way I had a problem with the lack of ProjectID in the 5 remaining projects (since they are not a part of the DB). The issue could be elsewhere, but that's a rock I hit.
I'll also try creating a ProjectBean with 6 project, on a form submit checking each of the rows for a new data. If user input is available, the project would be inserted in the table. I could also try using an actionListener to check for the input, but I'm not quite sure of getting the correct row I need when the listener is active.
Is there any elegant way of mapping the projects and insert the not- obligatory only if they contain data?
Thanks in advance,
nofearinc>
Straightforward enough: check if the values aren't null ;) You can also consider to add a valueChangeListener to one or more fields. It would only be fired if the field's value has been changed.
Thanks for the comment, It was just weird for me how to have a User with a List<Project> and not all of the projects are persisted :) It seems a little strange for me as a realization and I assume that Hibernate would also be confused after session saving. That's why I think that I'll need a list of backing beans which would lately be transfered to entities if data is persisted (just being curious if there is more easy and elegant way to do that).
The valueChangeListener would be called after any data is inserted in the row - it's possible that a user could go wrong and edit a field, then erase it again. So I have to insert in the DB only on a form submit (less DB activity).
I'll try this getRowData() method tomorrow, it seems like a reasonable solution if I could use it in my case (dataTable with list of projects and get each row as a particular project).
Thanks again for the reply, I'd be happy to hear any ideas on the subject ;)
nofearinc -
Equality between primitive and persistent objects
Folks,
I have discovered by chance that the KODO Query implementation allows me
to test for equality between an Integer and a persistent object. This is
actually phenomenally useful because it allows me to easily work around
some really inefficient auto-generated SQL (see below).
I couldn't find anything about this feature in the JDO specs. Is it
accidental? Is it supported, or likely to disappear in future versions?
Dave Syer.
# 'bean' is an object already loaded from the persistence store
javax.jdo.JDOHelper.getObjectId(bean)Bean-101
# it has one mutable property, which is persistence capable
# and also a read-only property which is the database id
# (Integer) of the property:
javax.jdo.JDOHelper.getObjectId(bean.getProperty())Property-371
bean.getPropertyId()371
# get an extent for querying (pm is the PersistenceManager)
ex=pm.getExtent(Bean,0)# First do a query on property...
qu=pm.newQuery(ex);
qu.declareParameters("Property id1");
qu.setFilter("property == id1")# ...generates SQL with additional unnecessary(?) Cartesian join
# to PROPERTY table:
res=qu.execute(bean.getProperty())# resulting SQL:
# SELECT t0.PROPERTY_ID, t0.PROPERTY_ID FROM BEAN t0, PROPERTY t1
# WHERE (t0.PROPERTY_ID = 371 AND t0.PROPERTY_ID =
# t1.PROPERTY_ID)
# Now do a query on propertyId (Integer)...
qu=pm.newQuery(ex);
qu.declareParameters("java.lang.Integer id1");
qu.setFilter("propertyId == id1")# ...but parameter value is allowed to be a Property -- magically
# turned into an integer when the SQL is generated:
res=qu.execute(bean.getProperty())# resulting SQL:
# SELECT t0.PROPERTY_ID, t0.PROPERTY_ID FROM BEAN t0 WHERE
# t0.PROPERTY_ID = 371It is accidental and unsupported.Is there any other way to get round the 'unnecessary join' issue that I
mentioned briefly in my original posting? In a real world example, I was
able to improve performance of a single query by a factor of 100 (and my
DB experts tell me there was no way to optimise indexes or anything at the
RDBMS level and achieve the same result).
DAve. -
Hi,
I'm using objects persistence. I've created a persistent class and using this for storing data in an index cluster table to use the stored data afterwards.
I've created methods for creating persistent object (using export to database), delete object and read object (using import to database).
But i'm not getting how to use update of existing stored object.
Any help would be appreciated.
Regards
RajeshPersistent objects were introduced in ABAP OO in order to replace physical data manipulation via open SQL statements by more abstract OO-typical GET and SET methods for a persistent data object. Has nothing to do with Dequeue/Enqueue.
I recommend reading chapter 3 of [Next Generation ABAP Development|http://www.sappress.com/product.cfm?account=&product=H1986] for the full story.
Greetings
Thomas -
Collection of non-persistent objects
Greetings
Is it possible to persist a Collection of non-persistent objects through the
kodo externalization feature? The non-persistent objects themselves are
externalizable, but I don't know how I would go about persisting a
Collection of them.
..droo.If you store them in some sort of externalized form in a single column it is
easy - just use externalization framework to ext and de-ext them to anf from
string. Couple of caveats you need to be aware of If your collection objects
are mutable:
1. You need to durty your collection field so it get prsisted on commit
2. on rollback Kodo will restore you collection content but not collection
member content. If they are mutable you will have to make their class
persistent with mapping "none" so they participate in transaction
"Drew Lethbridge" <[email protected]> wrote in message
news:BD0B44BF.544%[email protected]..
Greetings
Is it possible to persist a Collection of non-persistent objects throughthe
kodo externalization feature? The non-persistent objects themselves are
externalizable, but I don't know how I would go about persisting a
Collection of them.
.droo. -
Hello
Using Datastore identity, Is it possible to declare an instance variable on
a persistent object which will "automatically" be populated with the
datastore objectid when the enclosing object is retrieved from persistence?
This would be in preference to always calling JDOHelper.getObjectId(obj)?
[or persistenceManager.getObjectId(obj) ]
Thanks
..droo.We've done this using the jdoPostLoad callback as follows:
public void jdoPostLoad()
setObjectID(JDOHelper.getObjectId(this).toString());
Scott
Drew Lethbridge wrote:
Hello
Using Datastore identity, Is it possible to declare an instance variable on
a persistent object which will "automatically" be populated with the
datastore objectid when the enclosing object is retrieved from persistence?
This would be in preference to always calling JDOHelper.getObjectId(obj)?
[or persistenceManager.getObjectId(obj) ]
Thanks
..droo. -
Hi Gurus.,
I am little bit confused over Persistent Objects.. Y we need to use Persistent Objects.. Is it equal to Enquee/Dequee process of normal abap ..
Regards.,
S.SivakumarPersistent objects were introduced in ABAP OO in order to replace physical data manipulation via open SQL statements by more abstract OO-typical GET and SET methods for a persistent data object. Has nothing to do with Dequeue/Enqueue.
I recommend reading chapter 3 of [Next Generation ABAP Development|http://www.sappress.com/product.cfm?account=&product=H1986] for the full story.
Greetings
Thomas
Maybe you are looking for
-
How do I uninstall applications with a MacBook Pro?
Hai, I need help finding out how to uninstall applications with a MacBook Pro? -I just got this computer 5-6 days ago and I hardly know anything about it. (AS expected from a new user to a Mac computer. ) Everything is kind of confusing to me especia
-
My iPhone accelerometer isn't working correctly
My iPhone's accelermoter hasn't been working correctly for a bit now, I am unable to rotate to protrait on all apps and I have assured that protraite orientation isn't on lock. I have also tested the X,Y and Z axis on an app and it reads when placed
-
Which is better? iPhone 4 or the 4S?
Due for an upgrade in dec/Jan. Currently using 3GS. Is the 4S still having problems?
-
Motion 4: Motion tracking a moving mask
I'm making a video for our church which is a knockoff of the E-Trade babies commercials. I have a segment of it done which you can see here using the password "jaymack": http://www.vimeo.com/26897268 As you can see, I'm dealing with both a moving bab
-
How can I import my music files from my other computer
I got a a new laptop, and I would like to import the music files from my older PC. How can I do this? Best regards.