Search Results

Search found 3493 results on 140 pages for 'constructor'.

Page 14/140 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • How to avoid using this in a constructor

    - by Paralife
    I have this situation: interface MessageListener { void onMessageReceipt(Message message); } class MessageReceiver { MessageListener listener; public MessageReceiver(MessageListener listener, other arguments...) { this.listener = listener; } loop() { Message message = nextMessage(); listener.onMessageReceipt(message); } } and I want to avoid the following pattern: (Using the this in the Client constructor) class Client implements MessageListener { MessageReceiver receiver; MessageSender sender; public Client(...) { receiver = new MessageReceiver(this, other arguments...); sender = new Sender(...); } . . . @Override public void onMessageReceipt(Message message) { if(Message.isGood()) sender.send("Congrtulations"); else sender.send("Boooooooo"); } } The reason why i need the above functionality is because i want to call the sender inside the onMessageReceipt() function, for example to send a reply. But I dont want to pass the sender into a listener, so the only way I can think of is containing the sender in a class that implements the listener, hence the above resulting Client implementation. Is there a way to achive this without the use of 'this' in the constructor? It feels bizare and i dont like it, since i am passing myself to an object(MessageReceiver) before I am fully constructed. On the other hand, the MessageReceiver is not passed from outside, it is constructed inside, but does this 'purifies' the bizarre pattern? I am seeking for an alternative or an assurance of some kind that this is safe, or situations on which it might backfire on me.

    Read the article

  • java - powermock whenNew doesnt seem to work, calls the actual constructor

    - by user1331243
    I have two final classes that are used in my unit test. I am trying to use whenNew on the constructor of a final class, but I see that it calls the actual constructor. The code is @PrepareForTest({A.class, B.class, Provider.class}) @Test public void testGetStatus() throws Exception { B b = mock(B.class); when(b.getStatus()).thenReturn(1); whenNew(B.class).withArguments(anyString()).thenReturn(b); Provider p = new Provider(); int val = p.getStatus(); assertTrue((val == 1)); } public class Provider { public int getStatus() { B b = new B("test"); return b.getStatus(); } } public final class A { private void init() { // ...do soemthing } private static A a; private A() { } public static A getInstance() { if (a == null) { a = new A(); a.init(); } return a; } } public final class B { public B() { } public B(String s) { this(A.getInstance(), s); } public B(A a, String s) { } public int getStatus() { return 0; } } On debug, I find that its the actual class B instance created and not the mock instance that is returned for new usage and assertion fails. Any pointers on how to get this working. Thanks

    Read the article

  • Constructor initializer list: code from the C++ Primer, chapter 16

    - by Alexandros Gezerlis
    Toward the end of Chapter 16 of the "C++ Primer" I encountered the following code (I've removed a bunch of lines): class Sales_item { public: // default constructor: unbound handle Sales_item(): h() { } private: Handle<Item_base> h; // use-counted handle }; My problem is with the Sales_item(): h() { } line. For the sake of completeness, let me also quote the parts of the Handle class template that I think are relevant to my question (I think I don't need to show the Item_base class): template <class T> class Handle { public: // unbound handle Handle(T *p = 0): ptr(p), use(new size_t(1)) { } private: T* ptr; // shared object size_t *use; // count of how many Handles point to *ptr }; I would have expected something like either: a) Sales_item(): h(0) { } which is a convention the authors have used repeatedly in earlier chapters, or b) Handle<Item_base>() if the intention was to invoke the default constructor of the Handle class. Instead, what the book has is Sales_item(): h() { }. My gut reaction is that this is a typo, since h() looks suspiciously similar to a function declaration. On the other hand, I just tried compiling under g++ and running the example code that uses this class and it seems to be working correctly. Any thoughts?

    Read the article

  • Java NullPointerException In the constructor's class

    - by AndreaF
    I have made a Java class where I have defined a constructor and some methods but I get a NullPointer Exception, and I don't know how I could fix It. public class Job { String idJob; int time; int timeRun; Job j1; List<Job> startBeforeStart; List<Job> restricted; Job(String idJob, int time){ this.idJob=idJob; this.time=time; } public boolean isRestricted() { return restricted.size() != 0; } public void startsBeforeStartOf(Job job){ startBeforeStart.add(job); job.restricted.add(this); } public void startsAfterStartOf(Job job){ job.startsBeforeStartOf(this); } public void checkRestrictions(){ if (!isRestricted()){ System.out.println("+\n"); } else{ Iterator<Job> itR = restricted.iterator(); while(itR.hasNext()){ Job j1 = itR.next(); if(time>timeRun){ System.out.println("-\n"); time--; } else { restricted.remove(j1); } } } } @Override public boolean equals(Object obj) { return obj instanceof Job && ((Job) obj).idJob.equals(idJob); } public void run() { timeRun++; } } PS Looking in a forum a user says that to fix the error I should make an ArrayList inside the constructor (without modify the received parameters that should remain String id and int time), but I haven't understand what He mean.

    Read the article

  • Calling an Overridden Method from a Parent-Class Constructor

    - by Vaibhav Bajpai
    I tried calling an overridden method from a constructor of a parent class and noticed different behavior across languages. C++ - echoes A.foo() class A{ public: A(){foo();} virtual void foo(){cout<<"A.foo()";} }; class B : public A{ public: B(){} void foo(){cout<<"B.foo()";} }; int main(){ B *b = new B(); } Java - echoes B.foo() class A{ public A(){foo();} public void foo(){System.out.println("A.foo()");} } class B extends A{ public void foo(){System.out.println("B.foo()");} } class Demo{ public static void main(String args[]){ B b = new B(); } } C# - echoes B.foo() class A{ public A(){foo();} public virtual void foo(){Console.WriteLine("A.foo()");} } class B : A{ public override void foo(){Console.WriteLine("B.foo()");} } class MainClass { public static void Main (string[] args) { B b = new B(); } } I realize that in C++ objects are created from top-most parent going down the hierarchy, so when the constructor calls the overridden method, B does not even exist, so it calls the A' version of the method. However, I am not sure why I am getting different behavior in Java and C#.

    Read the article

  • Dynamically register constructor methods in an AbstractFactory at compile time using C++ templates

    - by Horacio
    When implementing a MessageFactory class to instatiate Message objects I used something like: class MessageFactory { public: static Message *create(int type) { switch(type) { case PING_MSG: return new PingMessage(); case PONG_MSG: return new PongMessage(); .... } } This works ok but every time I add a new message I have to add a new XXX_MSG and modify the switch statement. After some research I found a way to dynamically update the MessageFactory at compile time so I can add as many messages as I want without need to modify the MessageFactory itself. This allows for cleaner and easier to maintain code as I do not need to modify three different places to add/remove message classes: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <inttypes.h> class Message { protected: inline Message() {}; public: inline virtual ~Message() { } inline int getMessageType() const { return m_type; } virtual void say() = 0; protected: uint16_t m_type; }; template<int TYPE, typename IMPL> class MessageTmpl: public Message { enum { _MESSAGE_ID = TYPE }; public: static Message* Create() { return new IMPL(); } static const uint16_t MESSAGE_ID; // for registration protected: MessageTmpl() { m_type = MESSAGE_ID; } //use parameter to instanciate template }; typedef Message* (*t_pfFactory)(); class MessageFactory· { public: static uint16_t Register(uint16_t msgid, t_pfFactory factoryMethod) { printf("Registering constructor for msg id %d\n", msgid); m_List[msgid] = factoryMethod; return msgid; } static Message *Create(uint16_t msgid) { return m_List[msgid](); } static t_pfFactory m_List[65536]; }; template <int TYPE, typename IMPL> const uint16_t MessageTmpl<TYPE, IMPL >::MESSAGE_ID = MessageFactory::Register( MessageTmpl<TYPE, IMPL >::_MESSAGE_ID, &MessageTmpl<TYPE, IMPL >::Create); class PingMessage: public MessageTmpl < 10, PingMessage > {· public: PingMessage() {} virtual void say() { printf("Ping\n"); } }; class PongMessage: public MessageTmpl < 11, PongMessage > {· public: PongMessage() {} virtual void say() { printf("Pong\n"); } }; t_pfFactory MessageFactory::m_List[65536]; int main(int argc, char **argv) { Message *msg1; Message *msg2; msg1 = MessageFactory::Create(10); msg1->say(); msg2 = MessageFactory::Create(11); msg2->say(); delete msg1; delete msg2; return 0; } The template here does the magic by registering into the MessageFactory class, all new Message classes (e.g. PingMessage and PongMessage) that subclass from MessageTmpl. This works great and simplifies code maintenance but I still have some questions about this technique: Is this a known technique/pattern? what is the name? I want to search more info about it. I want to make the array for storing new constructors MessageFactory::m_List[65536] a std::map but doing so causes the program to segfault even before reaching main(). Creating an array of 65536 elements is overkill but I have not found a way to make this a dynamic container. For all message classes that are subclasses of MessageTmpl I have to implement the constructor. If not it won't register in the MessageFactory. For example commenting the constructor of the PongMessage: class PongMessage: public MessageTmpl < 11, PongMessage > { public: //PongMessage() {} /* HERE */ virtual void say() { printf("Pong\n"); } }; would result in the PongMessage class not being registered by the MessageFactory and the program would segfault in the MessageFactory::Create(11) line. The question is why the class won't register? Having to add the empty implementation of the 100+ messages I need feels inefficient and unnecessary.

    Read the article

  • C++ array initialization without assignment

    - by david
    This question is related to the post here. Is it possible to initialize an array without assigning it? For example, class foo's constructor wants an array of size 3, so I want to call foo( { 0, 0, 0 } ). I've tried this, and it does not work. I'd like to be able to initialize objects of type foo in other objects' constructor initialization lists. Is this possible?

    Read the article

  • I'm following Qt Tutorials and got a simple question

    - by nzer0
    If I want to create my own class MyWidget which inherits from QWidget Tutorial tells me to write constructor like this... MyWidget::MyWidget(QWidget *parent) : QWidget(parent){....} I'm wondering what is the role of : QWidget(parent) Does it mean explicit call for QWidget's constructor?

    Read the article

  • C++ class is not recognizing string data type

    - by reallythecrash
    I'm working on a program from my C++ textbook, and this this the first time I've really run into trouble. I just can't seem to see what is wrong here. Visual Studio is telling me Error: identifier "string" is undefined. I separated the program into three files. A header file for the class specification, a .cpp file for the class implementation and the main program file. These are the instructions from my book: Write a class named Car that has the following member variables: year. An int that holds the car's model year. make. A string that holds the make of the car. speed. An int that holds the car's current speed. In addition, the class should have the following member functions. Constructor. The constructor should accept the car's year and make as arguments and assign these values to the object's year and make member variables. The constructor should initialize the speed member variable to 0. Accessors. Appropriate accessor functions should be created to allow values to be retrieved from an object's year, make and speed member variables. There are more instructions, but they are not necessary to get this part to work. Here is my source code: // File Car.h -- Car class specification file #ifndef CAR_H #define CAR_H class Car { private: int year; string make; int speed; public: Car(int, string); int getYear(); string getMake(); int getSpeed(); }; #endif // File Car.cpp -- Car class function implementation file #include "Car.h" // Default Constructor Car::Car(int inputYear, string inputMake) { year = inputYear; make = inputMake; speed = 0; } // Accessors int Car::getYear() { return year; } string Car::getMake() { return make; } int Car::getSpeed() { return speed; } // Main program #include <iostream> #include <string> #include "Car.h" using namespace std; int main() { } I haven't written anything in the main program yet, because I can't get the class to compile. I've only linked the header file to the main program. Thanks in advance to all who take the time to investigate this problem for me.

    Read the article

  • Class Mapping Error: 'T' must be a non-abstract type with a public parameterless constructor

    - by Amit Ranjan
    Hi, While mapping class i am getting error 'T' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method. Below is my SqlReaderBase Class public abstract class SqlReaderBase<T> : ConnectionProvider { #region Abstract Methods protected abstract string commandText { get; } protected abstract CommandType commandType { get; } protected abstract Collection<IDataParameter> GetParameters(IDbCommand command); **protected abstract MapperBase<T> GetMapper();** #endregion #region Non Abstract Methods /// <summary> /// Method to Execute Select Queries for Retrieveing List of Result /// </summary> /// <returns></returns> public Collection<T> ExecuteReader() { //Collection of Type on which Template is applied Collection<T> collection = new Collection<T>(); // initializing connection using (IDbConnection connection = GetConnection()) { try { // creates command for sql operations IDbCommand command = connection.CreateCommand(); // assign connection to command command.Connection = connection; // assign query command.CommandText = commandText; //state what type of query is used, text, table or Sp command.CommandType = commandType; // retrieves parameter from IDataParameter Collection and assigns it to command object foreach (IDataParameter param in GetParameters(command)) command.Parameters.Add(param); // Establishes connection with database server connection.Open(); // Since it is designed for executing Select statements that will return a list of results // so we will call command's execute reader method that return a Forward Only reader with // list of results inside. using (IDataReader reader = command.ExecuteReader()) { try { // Call to Mapper Class of the template to map the data to its // respective fields MapperBase<T> mapper = GetMapper(); collection = mapper.MapAll(reader); } catch (Exception ex) // catch exception { throw ex; // log errr } finally { reader.Close(); reader.Dispose(); } } } catch (Exception ex) { throw ex; } finally { connection.Close(); connection.Dispose(); } } return collection; } #endregion } What I am trying to do is , I am executine some command and filling my class dynamically. The class is given below: namespace FooZo.Core { public class Restaurant { #region Private Member Variables private int _restaurantId = 0; private string _email = string.Empty; private string _website = string.Empty; private string _name = string.Empty; private string _address = string.Empty; private string _phone = string.Empty; private bool _hasMenu = false; private string _menuImagePath = string.Empty; private int _cuisine = 0; private bool _hasBar = false; private bool _hasHomeDelivery = false; private bool _hasDineIn = false; private int _type = 0; private string _restaurantImagePath = string.Empty; private string _serviceAvailableTill = string.Empty; private string _serviceAvailableFrom = string.Empty; public string Name { get { return _name; } set { _name = value; } } public string Address { get { return _address; } set { _address = value; } } public int RestaurantId { get { return _restaurantId; } set { _restaurantId = value; } } public string Website { get { return _website; } set { _website = value; } } public string Email { get { return _email; } set { _email = value; } } public string Phone { get { return _phone; } set { _phone = value; } } public bool HasMenu { get { return _hasMenu; } set { _hasMenu = value; } } public string MenuImagePath { get { return _menuImagePath; } set { _menuImagePath = value; } } public string RestaurantImagePath { get { return _restaurantImagePath; } set { _restaurantImagePath = value; } } public int Type { get { return _type; } set { _type = value; } } public int Cuisine { get { return _cuisine; } set { _cuisine = value; } } public bool HasBar { get { return _hasBar; } set { _hasBar = value; } } public bool HasHomeDelivery { get { return _hasHomeDelivery; } set { _hasHomeDelivery = value; } } public bool HasDineIn { get { return _hasDineIn; } set { _hasDineIn = value; } } public string ServiceAvailableFrom { get { return _serviceAvailableFrom; } set { _serviceAvailableFrom = value; } } public string ServiceAvailableTill { get { return _serviceAvailableTill; } set { _serviceAvailableTill = value; } } #endregion public Restaurant() { } } } For filling my class properties dynamically i have another class called MapperBase Class with following methods: public abstract class MapperBase<T> where T : new() { protected T Map(IDataRecord record) { T instance = new T(); string fieldName; PropertyInfo[] properties = typeof(T).GetProperties(); for (int i = 0; i < record.FieldCount; i++) { fieldName = record.GetName(i); foreach (PropertyInfo property in properties) { if (property.Name == fieldName) { property.SetValue(instance, record[i], null); } } } return instance; } public Collection<T> MapAll(IDataReader reader) { Collection<T> collection = new Collection<T>(); while (reader.Read()) { collection.Add(Map(reader)); } return collection; } } There is another class which inherits the SqlreaderBaseClass called DefaultSearch. Code is below public class DefaultSearch: SqlReaderBase<Restaurant> { protected override string commandText { get { return "Select Name from vw_Restaurants"; } } protected override CommandType commandType { get { return CommandType.Text; } } protected override Collection<IDataParameter> GetParameters(IDbCommand command) { Collection<IDataParameter> parameters = new Collection<IDataParameter>(); parameters.Clear(); return parameters; } protected override MapperBase<Restaurant> GetMapper() { MapperBase<Restaurant> mapper = new RMapper(); return mapper; } } But whenever I tried to build , I am getting error 'T' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method. Even T here is Restaurant has a Parameterless Public constructor.

    Read the article

  • MEF Constructor Parameters with Multiple Constructors

    - by InterWAS
    Hi, i starting to use MEF, and i have a class with multiple constructors, like this: [Export(typeof(ifoo))] class foo : ifoo { void foo() { ... } [ImportingConstructor] void foo(object par1) { ... } } Everthing works fine, except that the 2nd constructor is never called, i am using catalog.ComposeExportedValue() when composing, what's wrong?

    Read the article

  • Abstract class and constructor

    - by Amutha
    As abstract class can be instantiated ,still why constructor is allowed inside abstract class? public abstract class SomeClass { private string _label; public SomeClass(string label) { _label=label; } }

    Read the article

  • Ironpython - Named parameters to constructor

    - by yodaj007
    When I create an instance of my C# class in IronPython with named parameters to the constructor, it is setting properties corresponding to the names of the parameters. I wish to disable this behavior so I can have better control on the order the properties are evaluated. Is this possible?

    Read the article

  • PHP DOTNET - Passing Constructor Parameters to a C# Class

    - by n3wtz
    This seems like it should be a fairly straightforward question, but I can't find an answer anywhere. I'm using php's DOTNET class to instantiate a class from a .dll created with C#. The constructor of that class requires a couple of parameters. How to I pass them? Other Info: This is currently on Windows, and I've registered the .dll with the GAC, etc.

    Read the article

  • Pure Actionscript 3 Adobe Air Application main class constructor not being called

    - by SilverCode
    I'm writing an Air application using only Actionscript, and Flex3 SDK as the compiler. Everything compiles and runs fine under adl, but when the final air file is built and installed, the main class is never initialized. For instance: package { import flash.display.Sprite; public class main extends Sprite { public function main() { trace("Init"); } } } When run under ADL, "Init" will be output to the console, but when installed and run, nothing happens (the constructor for class main is never called).

    Read the article

  • C# Generic Static Constructor

    - by Seattle Leonard
    Will a static constructor on a generic class be run for every type you pass into the generic parameter such as this: class SomeGenericClass<T> { static List<T> _someList; static SomeGenericClass() { _someList = new List<T>(); } } Are there any draw backs to using this approach?

    Read the article

  • C# Custom EventArgs with no constructor?

    - by Motig
    I have a problem; I'm using an external library where one particular event has its own custom eventargs; with no constructor. If I want to throw my own event using these eventargs, how can I? I'll give more detail if asked, but I'm not sure what exactly I should be giving. :)

    Read the article

  • Java Collections Sort not accepting comparator constructor with arg

    - by harmzl
    I'm getting a compiler error for this line: Collections.sort(terms, new QuerySorter_TFmaxIDF(myInteger)); My customized Comparator is pretty basic; here's the signature and constructor: public class QuerySorter_TFmaxIDF implements Comparator<Term>{ private int numberOfDocs; QuerySorter_TFmaxIDF(int n){ super(); numberOfDocs = n; } } Is there an error because I'm passing an argument into the Comparator? I need to pass an argument...

    Read the article

  • @ContextConfiguration in Spring 3.0 give me No default constructor found

    - by atomsfat
    I have already do the test using AbstractDependencyInjectionSpringContextTests and it works but in spring 3 it is deprecated, so I decided to try @ContextConfiguration but spring say that default constructor is not found, I check and the class doesn't have any constructor. If I use this test spring give the object. package atoms.portales.servicios.impl; import atoms.portales.model.Cliente; import atoms.portales.servicios.ClienteService; import java.util.List; import javax.persistence.EntityManager; import org.springframework.test.AbstractDependencyInjectionSpringContextTests; /** * * @author tsalazar */ public class ClienteServiceImplDeTest extends AbstractDependencyInjectionSpringContextTests{ private ClienteService clienteService; public ClienteService getClienteService() { return clienteService; } public void setClienteService(ClienteService clienteService) { this.clienteService = clienteService; } public ClienteServiceImplDeTest(String testName) { super(testName); } @Override protected String[] getConfigLocations() { return new String[]{"PersistenceAppCtx.xml", "ServicesAppCtx.xml"}; } /** * Test of buscaCliente method, of class ClienteServiceImplDeTest. */ public void testBuscaCliente() { System.out.println("======================================="); System.out.println("buscaCliente"); String nombre = ""; System.out.println(clienteService); System.out.println("======================================="); } } But if I use this, spring say that default constructor is not found. package atoms.config.portales.servicios.impl; import atoms.portales.model.Cliente; import atoms.portales.servicios.ClienteService; import org.junit.runner.RunWith; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.TransactionConfiguration; import org.springframework.transaction.annotation.Transactional; /** * * @author tsalazar */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"/PersistenceAppCtx.xml", "/ServicesAppCtx.xml"}) @TransactionConfiguration(transactionManager = "transactionManager") @Transactional public class ClienteServiceImplTest { @Autowired private ClienteService clienteService; /** * Test of buscaCliente method, of class ClienteServiceImpl. */ @Test public void testBuscaCliente() { System.out.println("======================================="); System.out.println("buscaCliente"); System.out.println(clienteService); System.out.println("======================================="); } } This how I do the implementacion: package atoms.portales.servicios; import atoms.portales.model; /** * Una interface para obtener clientes, con sus surcursales, servicios, layouts * y contratos. Tambien soporta operaciones CRUD. * @author tsalazar */ public interface ClienteService { /** * Busca clientes a partir del nombre * @param nombre */ public Cliente buscaCliente(String nombre); } the implemetacion package atoms.portales..servicios.impl; import atoms.portales.model.Cliente; import atoms.portales.servicios.ClienteService; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.springframework.stereotype.Repository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; /** * A JPA-based implementation.Delegates to a JPA entity manager to issue data access calls * against the backing repository. The EntityManager reference is provided by the managing container (Spring) * automatically. */ @Service("clienteSerivice") @Repository public class ClienteServiceImpl implements ClienteService { public ClienteServiceImpl() { } private EntityManager em; @PersistenceContext public void setEntityManager(EntityManager em) { this.em = em; } @Transactional(readOnly = true) public Cliente buscaCliente(String nombre) { Cliente cliente = em.getReference(Cliente.class, 1l); return cliente; } } spring configuration: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <!-- Instructs Spring to perfrom declarative transaction management on annotated classes --> <tx:annotation-driven /> <!-- Drives transactions using local JPA APIs --> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean> <!-- Creates a EntityManagerFactory for use with the Hibernate JPA provider and a simple in-memory data source populated with test data --> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /> </property> </bean> <!-- Deploys a in-memory "booking" datasource populated --> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="org.hsqldb.jdbcDriver" /> <property name="url" value="jdbc:hsqldb:hsql://localhost/test" /> <property name="username" value="sa" /> <property name="password" value="" /> </bean> <context:component-scan base-package="atoms.portales.servicios" /> </beans> This is the persistence.xml <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="configuradorPortales" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>atoms.portales.model.Cliente</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/> </properties> </persistence-unit> </persistence> This is the error that give me:

    Read the article

  • Cannot mock class with constructor having array parameter using Rhino Mocks

    - by SharePoint Newbie
    Hi, We cannot mock his class in RhinoMocks. public class Service { public Service(Command[] commands){} } public abstract class Command {} // Code var mock = MockRepository.GenerateMock<Service>(new Command[]{}); // or mock = MockRepository.GenerateMock<Service>(null) Rhino mocks fails complaining that it cannot find a constructor with matching arguments. What am I doing wrong? Thanks,

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >