Search Results

Search found 199 results on 8 pages for 'transient'.

Page 1/8 | 1 2 3 4 5 6 7 8  | Next Page >

  • readObject() vs. readResolve() to restore transient fields

    - by Joonas Pulakka
    According to Serializable javadoc, readResolve() is intended for replacing an object read from the stream. But is it OK to use it for restoring transient fields, like so: private Object readResolve() { transientField = something; return this; } as opposed to using readObject(): private void readObject(ObjectInputStream s) { s.defaultReadObject(); transientField = something; } Is there any reason to choose one over other, when used to just restore transient fields?

    Read the article

  • Hibernate Transient Extends problem

    - by mrvreddy
    @MappedSuperclass public abstract class BaseAbstract implements Serializable{ private static final long serialVersionUID = 1L; protected String test = //some random value; public String getTest() { return test; } public void setTest(String test){ this.test = test; } } @Entity public class Artist extends BaseAbstract { private static final long serialVersionUID = 1L; private Integer id; @override @Transient public String getTest() { return test; } ..... } My question is... when i am trying to do any operation on the artist, along with id and name, test is also getting saved which should not be the case... if i add the same transient on the baseabstract class getTest() method, i see test column NOT getting created(ideally what it should happen) but if i try to override the method with adding annotaion in the sub class it creates the test column... I dont know why this is happening since when hibernate is creating the artist object and checks for annotations, it should see the transient annotation present on the getTest() of artist method...and should not create a column in the database... Let me know if you need any clarification.... Any response on this is greatly appreciated.... Thank you

    Read the article

  • Transient VO : Powerful J2EE Design Pattern

    - by Vijay Mohan
    We had a use-case wherein, the communication has to happen between regions residing under differenet taskfows. Essentially, they had a common set of parameters to be used. Initially, we resorted to the  use of pageFlowScope variables, but they are tightly coupled with the individual task flows. So, how the communication has to happen..?Some of the alternatives that we brainstormed into are - 1.usage of adf contextual event - This is a powerful feature indeed for such use-cases, but there is a considerable cost involved with it. So, before resorting to it, you have to make sure that you have good enough reason to use it.It actually does a server roundtrip and also the issue of an event and listening part to it is also something which requires your attention !!2.Use a transientVO with shared data control scope - with shared data control scope, the transient VO rows would be persistent across the task flows in your application. All you have to do is to create the attributes in the transientVO(prefereably with the same names - for the ease of conversion) and create some utility methods in VOImpl for creating row, updating row and deleting a row. You also have to make sure that the vo row is initialized per http request( this you can do in a bookmark method of your index.jspx - residing in adfc-config.xml), else the ui fields binded to the transient vo attributes won't render in UI.Hope, this helps and this should be a common use-case across apps.

    Read the article

  • I have a feeling that adding fields marked with @Transient annotation to entity is very bug-prone. A

    - by Roman
    I have some philosophical feeling that adding to an entity fields which doesn't mapped to the DB is a wrong way of solving problems. But are there any concrete situations where using @Transient fields leads to implicit and hard fixing problems? For example, is it possible that adding/removing 2nd level cache will break our app when there are @Transient fields in our entities?

    Read the article

  • Transient variables are not captured properly on form submission

    - by Kalpana
    My User entity class have several member variables (e.g. String firstName) which are persisted and some transient variables (e.g. transient boolean selected) which are not. I have used the transient variable to capture a checkbox selection, but invariably the value never gets set and procesed properly until I set another bean value along with it. i.e. If User has firstName (mapped to a text field) and selected (mapped to a checkbox) If I just selected the value doesn't seem to be set on an update If I had selected the checkbox and the firstName field, the "selected" value is captured properly Can anyone tell me why this is happening?

    Read the article

  • How to do @OneToMany mapping on the field using @transient

    - by hemal
    I am using JPA annotations here , I want to do @OneToMany mapping on filed declared as @Transient. is it possible to do mapping on @transient field ? SimpleTagGroup.java @Entity @Table(name = "TagGroup") public class SimpleTagGroup { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id = -1; @NotNull private String tagGroupName; @OneToMany(fetch = FetchType.EAGER) @JoinTable(name = "TagMapping", joinColumns = @JoinColumn(name = "id"), inverseJoinColumns = @JoinColumn(name = "tagId")) @Transient private List<SimpleTag> tags; SimpleTag.java @Entity @Table(name = "Tag") public class SimpleTag implements Tag{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id = -1; @NotNull private String tagValue;

    Read the article

  • Transient mysqlcheck errors about "size of datafile" (file too small)

    - by Adam Backstrom
    Running mysqlcheck on a live database is giving me transient errors like this one: mydatabase.mytable error : Size of datafile is: 500719688 Should be: 501000484 error : Corrupt When I run the command again or check the table one-off using mysql, it's listed as OK. Is this just a side effect of running checks on live tables? Is it possible that data is not flushed, hence the strange discrepancy? We moved several databases this morning by shutting down mysqld on the source and rsyncing files across to the new server, but these are all MyISAM tables so I don't believe the two things are related. (But I mention it just in case.)

    Read the article

  • Castle, sharing a transient component between a decorator and a decorated component

    - by Marius
    Consider the following example: public interface ITask { void Execute(); } public class LoggingTaskRunner : ITask { private readonly ITask _taskToDecorate; private readonly MessageBuffer _messageBuffer; public LoggingTaskRunner(ITask taskToDecorate, MessageBuffer messageBuffer) { _taskToDecorate = taskToDecorate; _messageBuffer = messageBuffer; } public void Execute() { _taskToDecorate.Execute(); Log(_messageBuffer); } private void Log(MessageBuffer messageBuffer) {} } public class TaskRunner : ITask { public TaskRunner(MessageBuffer messageBuffer) { } public void Execute() { } } public class MessageBuffer { } public class Configuration { public void Configure() { IWindsorContainer container = null; container.Register( Component.For<MessageBuffer>() .LifeStyle.Transient); container.Register( Component.For<ITask>() .ImplementedBy<LoggingTaskRunner>() .ServiceOverrides(ServiceOverride.ForKey("taskToDecorate").Eq("task.to.decorate"))); container.Register( Component.For<ITask>() .ImplementedBy<TaskRunner>() .Named("task.to.decorate")); } } How can I make Windsor instantiate the "shared" transient component so that both "Decorator" and "Decorated" gets the same instance? Edit: since the design is being critiqued I am posting something closer to what is being done in the app. Maybe someone can suggest a better solution (if sharing the transient resource between a logger and the true task is considered a bad design)

    Read the article

  • final transient fields and serialization

    - by doublep
    Is it possible to have final transient fields that are set to any non-default value after serialization in Java? My usecase is a cache variable — that's why it is transient. I also have a habit of making Map fields that won't be changed (i.e. contents of the map is changed, but object itself remains the same) final. However, these attributes seem to be contradictory — while compiler allows such a combination, I cannot have the field set to anything but null after unserialization. I tried the following, without success: simple field initialization (shown in the example): this is what I normally do, but the initialization doesn't seem to happen after unserialization; initialization in constructor (I believe this is semantically the same as above though); assigning the field in readObject() — cannot be done since the field is final. In the example cache is public only for testing. import java.io.*; import java.util.*; public class test { public static void main (String[] args) throws Exception { X x = new X (); System.out.println (x + " " + x.cache); ByteArrayOutputStream buffer = new ByteArrayOutputStream (); new ObjectOutputStream (buffer).writeObject (x); x = (X) new ObjectInputStream (new ByteArrayInputStream (buffer.toByteArray ())).readObject (); System.out.println (x + " " + x.cache); } public static class X implements Serializable { public final transient Map <Object, Object> cache = new HashMap <Object, Object> (); } } Output: test$X@1a46e30 {} test$X@190d11 null

    Read the article

  • Grails / GORM, read-only cache and transient fields

    - by Stephen Swensen
    Suppose I have the following Domain object mapping to a legacy table, utilizing read-only second-level cache, and having a transient field: class DomainObject { static def transients = ['userId'] Long id Long userId static mapping = { cache usage: 'read-only' table 'SOME_TABLE' } } I have a problem, references to DomainObject instances seem to be shared due to the caching, and thus transient fields are writing over each other. For example, def r1 = DomainObject.get(1) r1.userId = 22 def r2 = DomainObject.get(1) r2.userId = 34 assert r1.userId == 34 That is, r1 and r2 are references to the same instance. This is undesirable, I would like to cache the table data without sharing references. Any ideas?

    Read the article

  • Querying and ordering results of a database in grails using transient fields

    - by Azder
    I'm trying to display paged data out of a grails domain object. For example: I have a domain object Employee with the properties firstName and lastName which are transient, and when invoking their setter/getter methods they encrypt/decrypt the data. The data is saved in the database in encrypted binary format, thus not sortable by those fields. And yet again, not sortable by transient ones either, as noted in: http://www.grails.org/GSP+Tag+-+sortableColumn . So now I'm trying to find a way to use the transients in a way similar to: Employee.withCriteria( max: 10, offset: 30 ){ order 'lastName', 'asc' order 'firstName', 'asc' } The class is: class Employee { byte[] encryptedFirstName byte[] encryptedLastName static transients = [ 'firstName', 'lastName' ] String getFirstName(){ decrypt("encryptedFirstName") } void setFirstName(String item){ encrypt("encryptedFirstName",item) } String getLastName(){ decrypt("encryptedLastName") } void setLastName(String item){ encrypt("encryptedLastName",item) } }

    Read the article

  • object references an unsaved transient instance

    - by developer
    Hi, I have 2 tables, user and userprofile, both with almost identical fields. user table references userprofile table by primary key ID. My requirement is that on click of a button I need to dump user table record to userprofile table. Now for a particular user table, if there is a corresponding userprofile entry, I am successfully able to dump the data, but if there is no record in userprofile table then I need to create a new record by dumping all the data. My problem is that I am able to update the data when the record is present in userprofile table, but in the case wherein I have to create a new record I get the below error "object references an unsaved transient instance - save the transient instance before flushing". `<class name="User"> <id name="ID" type="Int32"> <generator class="native" /> </id> <many-to-one name="Pid" class="UserProfile" /> </class>` UserProfile is another table and Pid above references the Primary key ID of UserProfile table.

    Read the article

  • Resolving System Restore error - Error 0x800423F3 - The writer experienced a transient error

    - by Gishu
    System restore just stopped working, when I needed it most. (tried diff restore points... same error). Now everytime I run system-restore, it fails with the above error message. I cleared the event logs and retried to isolate the relevant events. I see 5 warnings and 1 info event from VSS and 1 error from System Restore. Here's the first warning from VSS and the error http://dl.dropbox.com/u/11733224/SystemRestore-FirstWarning.txt http://dl.dropbox.com/u/11733224/SystemRestore-FirstError.txt Tried a lot of stuff, but in vain; this error still persists.

    Read the article

  • Resolving System Restore error - Error 0x800423F3 - The writer experienced a transient error

    - by Gishu
    System restore just stopped working, when I needed it most. (tried diff restore points... same error). Now everytime I run system-restore, it fails with the above error message. I cleared the event logs and retried to isolate the relevant events. I see 5 warnings and 1 info event from VSS and 1 error from System Restore. Here's the first warning from VSS and the error http://dl.dropbox.com/u/11733224/SystemRestore-FirstWarning.txt http://dl.dropbox.com/u/11733224/SystemRestore-FirstError.txt Tried a lot of stuff, but in vain; this error still persists.

    Read the article

  • transient DNS issues with certain sites in Snow Leopard

    - by ceejayoz
    I'm having a rather bizarre DNS issue with Snow Leopard. Certain sites - MSNBC.com being the most noticeable for me - have an odd issue with DNS, in all browsers. After not visiting the site after a while (30 minutes or so), the first attempt to access MSNBC.com results in a DNS error. Refreshing 1-5 times resolves the issue until the next ~30 minute period of inactivity. Seen this on three separate Macs at this point. One from-the-factory Snow Leopard install, two upgrades. Most sites are just fine. I Google and found other reports of the same thing with MSNBC, but no solutions.

    Read the article

  • Transient network dropout for Xen DomU's

    - by Stephen C
    We've got a CentOS server running a cluster of virtuals. Occasionally the cluster's internal network drops out for a minute or so ... and then comes back. The problem is somehow related to the actual network traffic, but it is not a simple load issue. (The system is generally lightly loaded, and the problem occurs irrespective of actual load.) The setup: CentOS 5.6 on Dom0, various CentOS on the DomU's Hardware - a Dell R710 with a BroadCom NextXpress 2 NIC (sigh) using the latest drivers for the NIC from BroadCom Xen configured to use network-bridge and vif-bridge Some iptable tweaks to route an unrelated port to one of the virtuals. The system has one externally visible IP address, and Dom0 runs an Apache httpd configured with a number of virtual hosts each of which reverse proxies to web servers running on the virtuals. (The virtuals have to be NAT'ed, primarily because we don't have enough allocated public IP addresses.) The symptoms: Works fine most of the time. When someone tries to UPLOAD a large file to one virtuals, the internal network drops out ... for all virtuals: The Dom0 httpd sees a network timeout talking to the backend server on the virtual and reports a 502. A previously established ssh connection from Dom0 to any of the DomU's freezes. Our monitoring shows ping failures for traffic between virtuals. The Xen consoles to the DomU's do not freeze. No log messages in any log files that I can see, on either Dom0 or the DomU's ... apart from the Dom0 httpd logs. After a minute or so, the problem clears by itself. This is 100% reproducible. What we've tried: Downloading, building and installing the latest BNX2 driver on Dom0 Turning off MSI on the NIC - adding "options bnx2 disable_msi=1" to /etc/modprobe.conf Turning off tcp segmentation offload - "ethtool -K eth0 tso off". Sacrificing a black rooster at midnight. I've exhausted all my options apart from switching to KVM ... or slaughtering more roosters. Any suggestions?

    Read the article

  • save the transient instance before flushing

    - by eugenn
    Exception: object references an unsaved transient instance - save the transient instance before flushing: Child How to reproduce issue: 1. Hibernate is load the entity "Parent". The property "child" is null 2. The "Parent" is rendered on the screen and after that the "child" property is auto instantiated. So I have the following graph: Parent.child != null Parent.child.childId = null Parent.child.childKey = "" Parent.child.childName = "" Question: How I could to force the Hibernate to ignore updating or inserting Child entity WHEN childId = null? If childId != null I would like just create relation. <hibernate-mapping> <class name="com.test.Parent" entity-name="ParentObject" table="parent" dynamic-insert="false" dynamic-update="true" optimistic-lock="version"> <id name="rowId" type="long"> <column name="RowID" /> <generator class="native" /> </id> <version name="versionSequence" type="integer" unsaved-value="null" generated="never" insert="false"> <column name="VersionSequence" /> </version> <many-to-one name="child" entity-name="Child" fetch="select" optimistic-lock="true" embed-xml="false" update="true" insert="false"> <column name="ChildID" /> </many-to-one> <property name="dateCreated" type="timestamp"> <column name="DateCreated" length="0" /> </property> <property name="dateUpdated" type="timestamp" update="false"> <column name="DateUpdated" length="0" /> </property> </class> </hibernate-mapping> <hibernate-mapping> <class name="com.Child" entity-name="Child" table="Child" dynamic-insert="false" dynamic-update="true" optimistic-lock="version"> <id name="childId" type="long" > <column name="ChildID" /> <generator class="native" /> </id> <version name="versionSequence" type="integer" insert="false" generated="never" > <column name="VersionSequence" /> </version> <property name="childKey" type="string" > <column name="ChildKey" length="20" /> </property> <property name="childName" type="string" > <column name="ChildName" length="30" /> </property> <property name="childNumber" type="string" > <column name="ChildNumber" /> </property> <property name="dateCreated" type="timestamp"> <column name="DateCreated" /> </property> <property name="dateUpdated" type="timestamp" update="false"> <column name="DateUpdated" /> </property> </class> </hibernate-mapping>

    Read the article

  • NHibernate.PropertyValueException : not-null property references a null or transient

    - by frosty
    I am getting the following exception. NHibernate.PropertyValueException : not-null property references a null or transient Here are my mapping files. Product <class name="Product" table="Products"> <id name="Id" type="Int32" column="Id" unsaved-value="0"> <generator class="identity"/> </id> <set name="PriceBreaks" table="PriceBreaks" generic="true" cascade="all" inverse="true" > <key column="ProductId" /> <one-to-many class="EStore.Domain.Model.PriceBreak, EStore.Domain" /> </set> </class> Price Breaks <class name="PriceBreak" table="PriceBreaks"> <id name="Id" type="Int32" column="Id" unsaved-value="0"> <generator class="identity"/> </id> <property name="ProductId" column="ProductId" type="Int32" not-null="true" /> <many-to-one name="Product" column="ProductId" not-null="true" cascade="all" class="EStore.Domain.Model.Product, EStore.Domain" /> </class> I get the exception on the following method [Test] public void Can_Add_Price_Break() { IPriceBreakRepository repo = new PriceBreakRepository(); var priceBreak = new PriceBreak(); priceBreak.ProductId = 19; repo.Add(priceBreak); Assert.Greater(priceBreak.Id, 0); }

    Read the article

1 2 3 4 5 6 7 8  | Next Page >