How can I get the list of jars deployed in JBoss?
I want to compile some classes at runtime in EJB, but they may use some of the deployed jars, so I need to specify classpath during compilation.
I am using Hibernate 3, and having a particular issue when persisting a new Entity which has an association with an existing detached entity. Easiest way to explain this is via code samples. I have two entities, FooEntity and BarEntity, of which a BarEntity can be associated with many FooEntity:
@Entity
public class FooEntity implements Foo{
@Id
private Long id;
@ManyToOne(targetEntity = BarEntity.class)
@JoinColumn(name = "bar_id", referencedColumnName = "id")
@Cascade(value={CascadeType.ALL})
private Bar bar;
}
@Entity
public class BarEntity implements Bar{
@Id
private Long id;
@OneToMany(mappedBy = "bar", targetEntity = FooEntity.class)
private Set<Foo> foos;
}
Foo and Bar are interfaces that loosely define getters for the various fields. There are corresponding FooImpl and BarImpl classes that are essentially just the entity objects without the annotations.
What I am trying to do is construct a new instance of FooImpl, and persist it after setting a number of fields. The new Foo instance will have its 'bar' member set to an existing Bar (runtime being a BarEntity) from the database (retrieved via session.get(..)). After the FooImpl has all of its properties set, Apache Dozer is used to map between the 'domain' object FooImpl and the Entity FooEntity. What Dozer is doing in the background is instantiating a new FooEntity and setting all of the matching fields. BarEntity is cloned as well via instantiation and set the FooEntity's 'bar' member.
After this occurs, passing the new FooEntity object to persist. This throws the exception:
org.hibernate.PersistentObjectException: detached entity passed to persist: com.company.entity.BarEntity
Below is in code the steps that are occurring
FooImpl foo = new FooImpl();
//returns at runtime a persistent BarEntity through session.get()
Bar bar = BarService.getBar(1L);
foo.setBar(bar);
...
//This constructs a new instance of FooEntity, with a member 'bar' which itself is a new instance that is detached)
FooEntity entityToPersist = dozerMapper.map(foo, FooEntity.class);
...
session.persist(entityToPersist);
I have been able to resolve this issue by either removing or changing the @Cascade annotation, but that limits future use for say adding a new Foo with a new Bar attached to it already. Is there some solution here I am missing? I would be surprised if this issue hasn't been solved somewhere before, either by altering how Dozer Maps the children of Foo or how Hibernate reacts to a detached Child Entity.
I am generating some Xaml based on some other source of input. In some cases I am generating x:Name values but they have invalid characters. I found this article on MSDN:
XamlName Grammar
Which describes the grammar of a x:Name tag but doesn't tell me how to actually apply this. Clearly there is some code to validate this name at runtime but what is the easiest way to actually fix up a string with invalid characters?
We have a managed COM addin for Outlook
works flawlessly on a real machine
now using VMWare 6.05 I think whe we try and install our addin OL refuses to load us
and we keeo seeing a message( when we go to the manage addins dialog) saying a runtime error occurred when loading the COM component
Nothing on event viewer
We are seeing this on images of Office 2003 and 2007
anyone ever run into something like this where VMWare images are causing issues with OL addins
How can I write an extension method that converts a System.Drawing.Bitmap to a byte array? Why not:
<Extension()> _
Public Function ToByteArray(ByVal image As System.Drawing.Bitmap) As Byte()
Using ms = New MemoryStream()
image.Save(ms, image.RawFormat)
Return ms.ToArray()
End Using
End Function
Yet when I use that, I get "System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+." What am I doing wrong?
i need to use a single button for all forms in a vb.net project.
The single button should be called in the forms to perform operations.
For eg.,
In a form i need to save, update the records.
When i call the button, save and update buttons should be appeared at runtime
using the single button.
guide me....
Is there any utility similar to dumpbin(Visual Studio) in Qt that allows me to check the functions that are exposed in a Qt-Creator compiled dll ??
I need to know what methods are exposed in a given dll so that I can load the method dynamically at runtime using QLibrary.
Thanks,
De Costo
I'm moving my application from 3.x to 4.x as I prepare for the app store and found that I need to have 2 copies of all my custom pngs - my question is how can I determine what img to show and when. Example - how do I know to show the Find.png vs the [email protected]
Is it "safe" or "correct" to look for 4.x specific apis or does the iphone have a way to determine what platform you are on at runtime?
Thank you in advance
I know I can get the time take to evaluate a function can be printed out on the screen/stdout using the time function/macro.
The time macro returns the value of the evaluated function, which makes it great to use it inline. However I want to automatically measure the runtime under specific circumstances.
is there a function which returns the elapsed time in some library to hep with this benchmarking?
I have develop application on VS-2005 and installed it at another machine and along with application I have installed .net frameworks 2.0 version as per demand and it works well at time of installed and after some time if I try to open it it’s throw error like “ .Net Framework Initialization Error, Unable to find a version of the runtime to run this application.
Client Machine : Operating System is XP sp2
How to overcome from it?.
I am developing a Eclipse RCP plugin which uses JPA.
I tried to specify the database path via a variable give to the JVM on runtime.
The property is set correctly but the database is created in a folder named after the variable name (here: ${DBHOME}).
<property name="javax.persistence.jdbc.url" value="jdbc:derby:${DBHOME};create=true"/>
Is there a possibility to fix this?
Thx
Hi All
I have seen many other samples out there that draw smooth text on glass. But I can't use them. I need every single label that gets added at runtime to be smooth. I can't just "draw" text onto the screen.
Is this at all possible, and are there and sources around?
Thank you
I need to print out an easy to read object graph from Visual Studio because I need to show a customer the state of an object at runtime.
Are there any debug visualizers for this? Expanding everything in a quick watch window isn't easy enough for the customer to comprehend.
How can I know during runtime that my code threw a Warning?
example
try {
echo (25/0);
} catch (exception $exc) {
echo "exception catched";
}
throws a "Warning: Division by zero" error that i can not handle on my code.
I was trying to execute the below code in my javascript and got some exception
var now3 = new Date();
now3.addDays(-4);
Error throwed is
Microsoft JScript runtime error: Object doesn't support this property or method
I m using jQuery 1.3.2 in my page .
Whats wrong with this? Please help
I'm looking for a lightweight java reporting engine to be embedded in an applet application.
My first option was Jasper Reports, but the jar is over 2Mb, a little too heavy (and too bloated) for my needs. I don't know if there is modular jasper distribution, with funcionalities split in several jars (like html rendering, pdf, excel, compilation, runtime, etc).
I need to preview the report using Swing and print it. PDF export is a plus.
I am using vb.net 2005. i am trying to set report groupings of a crystal report at runtime based on user defined options. MSDN says this:
Dim FieldDef As FieldDefinition
FieldDef =
Report.Database.Tables.Item(0).Fields.Item(comboBox1().Text)
Report.DataDefinition.Groups.Item(0).ConditionField = FieldDef
but error shows invalid group number
how to solve this?
what should be the parameter for create object the following code
dim a
set a=CreateObject("Collection") //getting a runtime error saying ActiveX
//component can't create object: 'Collection
a.add(CreateObject("Collection"))
a.Items(0).Add(1)
MsgBox(a.Items(0).count)
MsgBox(a.Items(0).Item(0))
Please, describe nowadays projects you took part in where C++ platform was preferred to .net where .net runtime could be installed.
Some of my friends works in SCADA area. They have to program microcontrollers with Linux Embedded and so on. So my friends have nearly no choice in programming tools. But when you had, why did you prefer C++ ?
What's the fastest way to draw a Hello World on the screen as a GUI in Java,
1- by using the minimum number of classes.
2- with the least byte code executed
2- the JVM tweaks
so when I double click on the Jar file in Windows, the Hello World appears in no time (assuming the Runtime is not already loaded).
I'm an extension noob. What I want to do is create an extension that doesn't require other libraries to be installed. Is this impossible because the extension has to link against a specific version of libpython at runtime?
I am trying to index a numpy.array with varying dimensions during runtime. To retrieve e.g. the first row of a n*m array a, you can simply do
a[0,:]
However, in case a happens to be a 1xn vector, this code above returns an index error:
IndexError: too many indices
As the code needs to be executed as efficiently as possible I don't want to introduce an if statement. Does anybody have a convenient solution that ideally doesn't involve changing any data structure types?
I need to have transparent textbox, in my WindowsPhone 8.1 Runtime application.
I made Background="Transparent" to the textbox, so it is transparent when it is loaded.
But on focus, background color changed to white. I write the following code, to make it transparent. But it doesn't run.!
<TextBox Background="Transparent" GotFocus="titleBox_GotFocus" />
C#
private void titleBox_GotFocus(object sender, RoutedEventArgs e)
{
titleBox.Background = new SolidColorBrush(Colors.Transparent);
}