Search Results

Search found 20 results on 1 pages for 'molleman'.

Page 1/1 | 1 

  • Trouble with apache saarting on boot with ssl api key

    - by molleman
    Im Running on Centos, the trouble is when i restart my server i need to start my apache and varnish service I use this to start both of them service httpd restart && service varnish restart But i would likw both of them to start when i reboot the server I read i could use this chkconfig httpd on But this is only for apache could i do this chkconfig varnish on Finally when i do y usual start of httpd , i am asked for my api key for SSL , am i able to incorporate this into resarting both varnish and httpd on start up. Or am i doomed to run this command everytime i resart

    Read the article

  • How to Enable geoip on magento with varnish page cache

    - by molleman
    I currently have 3 stores online with 3 different domains, running magento with Apache and varnish (using Phoenix page cache extension) running on centos One store is for uk, another for Ireland and another for USA Trouble is (Example) If an US user hits the uk store , I would like the user to be notified to go to the correct store on the page, (I do not want them automatically redirected) I was able to php-pecl-geoip with maxmind database to get this to work, but as users on my website have increased I had to begin using varnish. how could I implement this functionality on with varnish so I know what country the user is from so I can display a message to the user to view their relevant website?

    Read the article

  • Trouble with apache starting on boot with ssl api key

    - by molleman
    Im Running on Centos, the trouble is when i restart my server i need to start my apache and varnish service I use this to start both of them service httpd restart && service varnish restart But i would likw both of them to start when i reboot the server I read i could use this chkconfig httpd on But this is only for apache could i do this chkconfig varnish on Finally when i do y usual start of httpd , i am asked for my api key for SSL , am i able to incorporate this into resarting both varnish and httpd on start up. Or am i doomed to run this command everytime i resart

    Read the article

  • Where to start when setting up a gambling website [closed]

    - by molleman
    I don't know if this is the correct place or this question by I couldn't find anywhere else. I am looking into building a gambling website, I have good HTML CSS and JavaScript skills but I do not know enough of the server side to actually build a backend for a gambling website. Firstly where would you start , what language , I work With Wordpress , so I understand php a little but not a lot . Would php be a good place to start . If so what framework would be able to scale if the number of users on the website increased . clearly I would like a backend where you could view 1. Users 2. Transactions 3. input games which you can bet on And so on.. Also users should be able to see all there associated information If anyone could help that would be great.

    Read the article

  • How to use GWT when downloading Files with a Servlet?

    - by molleman
    Hello Guys I am creating a simple project that will allow me to upload and download files using gwt. i am having trouble with the downloading of files that are on my server. For the file upload i used http://code.google.com/p/gwtupload/ and followed the instructions there. My file is stored on the server outside of the website container(on the hard drive), Now when it comes to the downloading of a file, i want a user to press a download button and whatever item is currently selected will download. i dont really know how this will be done i know i need a download servlet public class DownloadAttachmentServlet extends HttpServlet { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // TODO Auto-generated method stub super.doGet(req, resp); } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String fileName = (String) req.getSession().getAttribute("fileName"); YFUser user = (YFUser) req.getSession().getAttribute(TestServiceImpl.SESSION_USER); if (user == null) throw new ServletException("Invalid Session"); InputStream in = null; OutputStream out = resp.getOutputStream(); FileInputStream fIn = new FileInputStream(fileName); byte[] buffer = new byte[4096]; int length; while ((length = in.read(buffer)) > 0){ out.write(buffer, 0, length); } in.close(); out.flush(); } } for the moment i will just pass a fileName string to retrieve the file for testing now i am lost at what to do on the client side, i have a simple public class DownloadFilePanel extends Composite { public DownloadFilePanel(final YFUser user , final String fileName){ final Element downloadIframe = RootPanel.get("__download").getElement(); VerticalPanel content = new VerticalPanel(); content.add(new Label("Download For this File : " + fileName)); Button button = new Button("Download"); button.addClickHandler(new ClickHandler(){ @Override public void onClick(ClickEvent event) { // i do not know what to do here }); content.add(button); initWidget(content); } } above is a simple widget that will supply a panel that will allow for the download of a file based on a fileName as you can see above, i do not know what to do to be able to download the file is there any one that can point me in the right direction?

    Read the article

  • Help needed implementing a web based file management system with a file hierarchy system, help neede

    - by molleman
    Hello i am trying to create a web application that will allow users to upload files online, i am using gwt while using hibernate for database communication, i am able to upload file to a server , and store them on the server. but what i want is to associate the files with a user. i want the user to be able to create folders and store a file in sub folders. my logic was to use the composite pattern to store folders and fileLocations with a user but i am am finding it difficult to implement this so i can show the files and folders within a gwt tree. what would be the best way to implement a hierarchy of folders and information of the location of a file so it could be displayed in a gwt tree? what i did have was a User would hold a reference to a root folder and then each sub folder could hold folders or fileLocations. i used the composite pattern to implement the file hierarchy, but when i want to display a the contents of a folder i need a for loop for each list. so i could a folder within a folder within a folder that would need 3 for loops to show the contents of my folders. What is the best way to implement this file management system. so what do you guys think?

    Read the article

  • LazyInitializationException when adding to a list that is held within a entity class using hibernate

    - by molleman
    Right so i am working with hibernate gilead and gwt to persist my data on users and files of a website. my users have a list of file locations. i am using annotations to map my classes to the database. i am getting a org.hibernate.LazyInitializationException when i try to add file locations to the list that is held in the user class. this is a method below that is overridden from a external file upload servlet class that i am using. when the file uploads it calls this method. the user1 is loaded from the database elsewhere. the exception occurs at user1.getFileLocations().add(fileLocation); . i dont understand it really at all.! any help would be great. the stack trace of the error is below public String executeAction(HttpServletRequest request, List<FileItem> sessionFiles) throws UploadActionException { for (FileItem item : sessionFiles) { if (false == item.isFormField()) { try { YFUser user1 = (YFUser)getSession().getAttribute(SESSION_USER); // This is the location where a file will be stored String fileLocationString = "/Users/Stefano/Desktop/UploadedFiles/" + user1.getUsername(); File fl = new File(fileLocationString); fl.mkdir(); // so here i will create the a file container for my uploaded file File file = File.createTempFile("upload-", ".bin",fl); // this is where the file is written to disk item.write(file); // the FileLocation object is then created FileLocation fileLocation = new FileLocation(); fileLocation.setLocation(fileLocationString); //test System.out.println("file path = "+file.getPath()); user1.getFileLocations().add(fileLocation); //the line above is where the exception occurs } catch (Exception e) { throw new UploadActionException(e.getMessage()); } } removeSessionFileItems(request); } return null; } //This is the class file for a Your Files User @Entity @Table(name = "yf_user_table") public class YFUser implements Serializable,ILightEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "user_id",nullable = false) private int userId; @Column(name = "username") private String username; @Column(name = "password") private String password; @Column(name = "email") private String email; @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "USER_FILELOCATION", joinColumns = { @JoinColumn(name = "user_id") }, inverseJoinColumns = { @JoinColumn(name = "locationId") }) private List<FileLocation> fileLocations = new ArrayList<FileLocation>() ; public YFUser(){ } public int getUserId() { return userId; } private void setUserId(int userId) { this.userId = userId; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public List<FileLocation> getFileLocations() { if(fileLocations ==null){ fileLocations = new ArrayList<FileLocation>(); } return fileLocations; } public void setFileLocations(List<FileLocation> fileLocations) { this.fileLocations = fileLocations; } /* public void addFileLocation(FileLocation location){ fileLocations.add(location); }*/ @Override public void addProxyInformation(String property, Object proxyInfo) { // TODO Auto-generated method stub } @Override public String getDebugString() { // TODO Auto-generated method stub return null; } @Override public Object getProxyInformation(String property) { // TODO Auto-generated method stub return null; } @Override public boolean isInitialized(String property) { // TODO Auto-generated method stub return false; } @Override public void removeProxyInformation(String property) { // TODO Auto-generated method stub } @Override public void setInitialized(String property, boolean initialised) { // TODO Auto-generated method stub } @Override public Object getValue() { // TODO Auto-generated method stub return null; } } @Entity @Table(name = "fileLocationTable") public class FileLocation implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "locationId", updatable = false, nullable = false) private int ieId; @Column (name = "location") private String location; public FileLocation(){ } public int getIeId() { return ieId; } private void setIeId(int ieId) { this.ieId = ieId; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } } Apr 2, 2010 11:33:12 PM org.hibernate.LazyInitializationException <init> SEVERE: failed to lazily initialize a collection of role: com.example.client.YFUser.fileLocations, no session or session was closed org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.example.client.YFUser.fileLocations, no session or session was closed at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380) at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372) at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:365) at org.hibernate.collection.AbstractPersistentCollection.write(AbstractPersistentCollection.java:205) at org.hibernate.collection.PersistentBag.add(PersistentBag.java:297) at com.example.server.TestServiceImpl.saveFileLocation(TestServiceImpl.java:132) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at net.sf.gilead.gwt.PersistentRemoteService.processCall(PersistentRemoteService.java:174) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:224) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:713) at javax.servlet.http.HttpServlet.service(HttpServlet.java:806) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) Apr 2, 2010 11:33:12 PM net.sf.gilead.core.PersistentBeanManager clonePojo INFO: Third party instance, not cloned : org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.example.client.YFUser.fileLocations, no session or session was closed

    Read the article

  • .LazyInitializationException when adding to a list that is held within a entity class using hibernat

    - by molleman
    Right so i am working with hibernate gilead and gwt to persist my data on users and files of a website. my users have a list of file locations. i am using annotations to map my classes to the database. i am getting a org.hibernate.LazyInitializationException when i try to add file locations to the list that is held in the user class. this is a method below that is overridden from a external file upload servlet class that i am using. when the file uploads it calls this method. the user1 is loaded from the database elsewhere. the exception occurs at user1.getFileLocations().add(fileLocation); . i dont understand it really at all.! any help would be great. the stack trace of the error is below public String executeAction(HttpServletRequest request, List<FileItem> sessionFiles) throws UploadActionException { for (FileItem item : sessionFiles) { if (false == item.isFormField()) { try { YFUser user1 = (YFUser)getSession().getAttribute(SESSION_USER); // This is the location where a file will be stored String fileLocationString = "/Users/Stefano/Desktop/UploadedFiles/" + user1.getUsername(); File fl = new File(fileLocationString); fl.mkdir(); // so here i will create the a file container for my uploaded file File file = File.createTempFile("upload-", ".bin",fl); // this is where the file is written to disk item.write(file); // the FileLocation object is then created FileLocation fileLocation = new FileLocation(); fileLocation.setLocation(fileLocationString); //test System.out.println("file path = "+file.getPath()); user1.getFileLocations().add(fileLocation); //the line above is where the exception occurs } catch (Exception e) { throw new UploadActionException(e.getMessage()); } } removeSessionFileItems(request); } return null; } //This is the class file for a Your Files User @Entity @Table(name = "yf_user_table") public class YFUser implements Serializable,ILightEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "user_id",nullable = false) private int userId; @Column(name = "username") private String username; @Column(name = "password") private String password; @Column(name = "email") private String email; @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "USER_FILELOCATION", joinColumns = { @JoinColumn(name = "user_id") }, inverseJoinColumns = { @JoinColumn(name = "locationId") }) private List<FileLocation> fileLocations = new ArrayList<FileLocation>() ; public YFUser(){ } public int getUserId() { return userId; } private void setUserId(int userId) { this.userId = userId; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public List<FileLocation> getFileLocations() { if(fileLocations ==null){ fileLocations = new ArrayList<FileLocation>(); } return fileLocations; } public void setFileLocations(List<FileLocation> fileLocations) { this.fileLocations = fileLocations; } /* public void addFileLocation(FileLocation location){ fileLocations.add(location); }*/ @Override public void addProxyInformation(String property, Object proxyInfo) { // TODO Auto-generated method stub } @Override public String getDebugString() { // TODO Auto-generated method stub return null; } @Override public Object getProxyInformation(String property) { // TODO Auto-generated method stub return null; } @Override public boolean isInitialized(String property) { // TODO Auto-generated method stub return false; } @Override public void removeProxyInformation(String property) { // TODO Auto-generated method stub } @Override public void setInitialized(String property, boolean initialised) { // TODO Auto-generated method stub } @Override public Object getValue() { // TODO Auto-generated method stub return null; } } @Entity @Table(name = "fileLocationTable") public class FileLocation implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "locationId", updatable = false, nullable = false) private int ieId; @Column (name = "location") private String location; /* private List uploadedUsers = new ArrayList(); */ public FileLocation(){ } public int getIeId() { return ieId; } private void setIeId(int ieId) { this.ieId = ieId; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } /* public List getUploadedUsers() { return uploadedUsers; } public void setUploadedUsers(List<YFUser> uploadedUsers) { this.uploadedUsers = uploadedUsers; } public void addUploadedUser(YFUser user){ uploadedUsers.add(user); } */ } Apr 2, 2010 11:33:12 PM org.hibernate.LazyInitializationException <init> SEVERE: failed to lazily initialize a collection of role: com.example.client.YFUser.fileLocations, no session or session was closed org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.example.client.YFUser.fileLocations, no session or session was closed at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380) at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372) at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:365) at org.hibernate.collection.AbstractPersistentCollection.write(AbstractPersistentCollection.java:205) at org.hibernate.collection.PersistentBag.add(PersistentBag.java:297) at com.example.server.TestServiceImpl.saveFileLocation(TestServiceImpl.java:132) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at net.sf.gilead.gwt.PersistentRemoteService.processCall(PersistentRemoteService.java:174) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:224) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:713) at javax.servlet.http.HttpServlet.service(HttpServlet.java:806) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488) Apr 2, 2010 11:33:12 PM net.sf.gilead.core.PersistentBeanManager clonePojo INFO: Third party instance, not cloned : org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.example.client.YFUser.fileLocations, no session or session was closed

    Read the article

  • Interfaces with hibernate annotations

    - by molleman
    Hello i am wondering how i would be able to annotate an interface @Entity @Table(name = "FOLDER_TABLE") public class Folder implements Serializable, Hierarchy { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "folder_id", updatable = false, nullable = false) private int fId; @Column(name = "folder_name") private String folderName; @OneToMany(cascade = CascadeType.ALL) @JoinTable(name = "FOLDER_JOIN_FILE_INFORMATION_TABLE", joinColumns = { @JoinColumn(name = "folder_id") }, inverseJoinColumns = { @JoinColumn(name = "file_information_id") }) private List< Hierarchy > fileInformation = new ArrayList< Hierarchy >(); above and below are 2 classes that implement an interface called Hierarchy, the folder class has a list of Hierarchyies being a folder or a fileinformation class @Entity @Table(name = "FILE_INFORMATION_TABLE") public class FileInformation implements Serializable, Hierarchy { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "file_information_id", updatable = false, nullable = false) private int ieId; @Column (name = "location") private String location; i have serached the web for someway to annotate or a workaround but i cannot map the interface which is simply this public interface Hierarchy { } i get a mapping exeception on the List of hierarchyies with a folder but i dont know how to map the class correctly

    Read the article

  • question on GWT and dockpanel , sizing and resizing

    - by molleman
    Hello guys, question on dock panels within gwt So i want the dockpanel to take up the whole size of the browser window dockPanel.setSize("100%", "100%"); if this correct Next Question, i am going to add a north panel , that will be 100px high and take up the whole width of the browser topPanel.setSize("100%", "100px"); dockPanel.add(topPanel, DockPanel.NORTH); is this correct, then i want to add a west panel that is 200px wide and the whole length of the browser up to just under the north panel westSideStackPanel.setSize("200px","100%") mainPanel.add(westSideStackPanel,DockPanel.WEST); i have created all this but when i look at my dockpanel there is a big gap between the west panel and the north panel the whole way accross the screen. why would this be? The north panel stays at 100px, and then there is a gap of about 100px high the whole width of the screen.

    Read the article

  • Help regarding composite pattern with hibernate

    - by molleman
    Hello, So i am stuck, i am creating a gwt web application, i will be using a tree(gwt Tree and TreeItems) structure to show a list of folders(class Folder) and files(class FileLocation), the folder and filelocation class will all implement a Hierarchy interface basing the classes on the composite pattern. but i am using hibernate to store my data , and i am using annotations for the mapping of the data to the database. my trouble is i do not know how to annotate my interface. have any of you guys used the composite pattern while persisting the data with hibernate public interface Hierarchy(){ // a few abstract methods that will be implemented by the sub classes } @Entity @Table() public class Folder extends Hierarchy implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "folder_id", updatable = false, nullable = false) private int id; @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.EAGER) @JoinTable(name = "FOLDER_FILELOCATION", joinColumns = { @JoinColumn(name = "folder_id") }, inverseJoinColumns = { @JoinColumn(name = "file_information_id") }) private List<Hierarchy> children = new ArrayList<Hierarchy>() ; @Column(name = "folder_name") private String folderName; @Column(name = "tree_item") private TreeItem item; @Column (name = "parent") private Hierarchy parent; @Entity @Table(name = "FILE_INFORMATION_TABLE") public class FileInformation extends Hierarchy implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "file_information_id", updatable = false, nullable = false) private int fiId; @Column (name = "location") private String location; @Column(name = "tree_item") private TreeItem item; @Column (name = "parent") private Hierarchy parent;

    Read the article

  • org.hibernate.NonUniqueObjectException Within GWT application using hibernate through gilead

    - by molleman
    Hello Guys, i am working on a project for college that uses GWT,Hibernate and Gilead. Basically for the moment users should be able to add friends and remove them. also a user can see if his or her friends are online or not. my trouble is that when i add a friend that is already related to another friend i get this error org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.example.client.YFUser#4] i have a service class public class TestServiceImpl extends PersistentRemoteService implements TestService { this is my service class for my gwt application. my toruble is here with my implmentation class of my serivce in this method that is called when a user presses add friend button on the client-side public void addYFUserFriend(String userName){ //this retrieves the current user YFUser user = (YFUser)getSession().getAttribute(SESSION_USER); Session session = com.example.server.HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); YFUser friend = (YFUser) session.createQuery("select u FROM YFUser u where u.username = :username").setParameter("username", userName).uniqueResult(); System.out.println("user " + friend.getUsername() + " Found"); user.getFriends().add(friend); friend.getBefriended().add(user); session.update(user); session.update(friend); session.getTransaction().commit(); } a scenerio : user1 adds user2 as a friend. this works fine. then user3 adds user2 and the exeception is thrown. any ideas why and where my logic is going wrong Ok so i have changed my code, and i have removed all the getCurrentASession() calls and replaced with openSession() call which are closed at the appropiate point, now the error i am getting is com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract void com.example.client.TestService.addYFUserFriend(java.lang.String)' threw an unexpected exception: org.hibernate.NonUniqueResultException: query did not return a unique result: 3

    Read the article

  • question on database query using hibernate in java with annotations

    - by molleman
    Hello, simple question regarding HQL(Hibernate query language) so i have user class , that can hold a list of Projects, how do i take this out of the database depending on a username, this is how i take out my user String username = "stephen"; YFUser user = (YFUser) session.createQuery("select u FROM YFUser u where u.username = :username").setParameter("username", name).uniqueResult(); but i want to take out the list of projects here is the projects list within the class YFUser(my user class); how would i query the database to get this list of projects @Entity @Table(name = "yf_user_table") public class YFUser implements Serializable,ILightEntity { ......... @OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinTable(name = "YFUSER_JOIN_PROJECT", joinColumns = { @JoinColumn(name = "user_id") }, inverseJoinColumns = { @JoinColumn(name = "project_id") }) private List<Project> projects = new ArrayList<Project>();

    Read the article

  • File Hierarchy system with a web application logic question: List searching

    - by molleman
    I need to search through a list of folders that could have more folders inside it, and add a new folder depending what folder is its parent.(the path is stored as a String for eg = "root/MyCom/home/") Then i fill in a field with a new folder name and add it to the final folder(eg "home/"). Below as you can see , I can navigate to the right location and add the new folder to a current folder, My trouble is that i cannot ensure that currentFolder element is placed back in the list it came from how could i add a folder to a list of folders, that could be within a list of folders,that could be within a list of folders and endless more? YFUser user = (YFUser)getSession().getAttribute(SESSION_USER); Folder newFolder = new Folder(); newFolder.setFolderName(foldername); // this is the path string (root/MyCom/home/) split in the different folder names String folderNames[] = folderLocationString.split("/"); int folderNamesLength = folderNames.length; Folder root = user.getRoot(); Folder currentFolder = root; for(int i=0;i<=folderNamesLength; i++){ // because root is folderNames[i] String folderName = folderNames[i++]; int currentFolderSize = currentFolder.getChildren.getSize(); for(int o=1; o<= currentFolderSize ; o++){ if(currentFolder.getChildren().get(o) instanceof Folder){ if(folderName.equals(currentFolder.getChildren().get(o).getFolderName())){ currentFolder = currentFolder.getChildren().get(o); if (i == counter){ //now i am inside the correct folder and i add it to the list of folders within it //the trouble is knowing how to re add this changed folder back to the list before it currentFolder.getChildren.add(newFolder); } } } } }

    Read the article

  • question on regular servlets within GWT (working in dev mode ,not working in deployment in tomcat)

    - by molleman
    Hello guys, i am having trouble with my web application developed in GWT. the application allows users to upload and download using an upload servlet and a download servlet, the upload servlet was created using the gwtUpload library. the download servlet is using regular HTTPServlet. when i run the application within eclipse the download servlet works fine, when i deploy it to tomcat, when a user selects to upload a file, the file does not download, when a user selects a link to download a file, this error is returned type Status report message /testhibernategilead/downloadServlet description The requested resource (/testhibernategilead/downloadServlet) is not available. can anyone explain why this is

    Read the article

  • question on rss feed application

    - by molleman
    Hello Guys i just want to create a simple application that will allow a user to input a url to a rss feed and display the contents to a user. what would be a good java library to enable me to read rss feeds? cheers

    Read the article

  • how do i supply data to my gwt tree

    - by molleman
    Hello, So i need to create a tree with tree items for my gwt project. i am using the composite pattern to store all the information i need to be placed within a tree. A User has a root Folder that extends Hierarchy, this root Folder then has a list of Hierarchy objects, that can be FileLocations or Folders. Trouble i am having is building my tree based on this pattern. this data is all stored using hibernate in a mysql database How would i be able to implement this as a tree in gwt. Also the tree item that i create would have to reference back to the object so i can rename or move it.

    Read the article

  • Question on using Informa RSS Library

    - by molleman
    hello guys I Just started looking at this technology , but i am finding it hard to understand, i want to just reed in a simple rss feed url, and display its contents how could i do this? this is what i lloked at so far URL inpFile = new URL("feed://images.apple.com/main/rss/hotnews/hotnews.rss"); ChannelIF channel = FeedParser.parse(new ChannelBuilder(), inpFile); System.out.println(channel.getDescription()); this creates a malformed url exeception, can anyone help me???

    Read the article

1